Partager via


ParentObject (Role Interface)

ms132804.note(fr-fr,SQL.90).gifRemarque :
  Cette fonctionnalité sera supprimée dans la prochaine version de Microsoft SQL Server. Évitez d'utiliser cette fonctionnalité dans de nouveaux travaux de développement, et modifiez dès que possible les applications qui utilisent actuellement cette fonctionnalité.

The ParentObject property returns a reference to the default interface of the parent object.

Applies To:clsCubeRole, clsDatabaseRole, clsMiningModelRole

Data Type

Object

The default interface and ClassType value of the returned object depends on the value of the ClassType property of the object.

Class type Returned object interface Returned object class type

clsDatabaseRole

MDStore

clsDatabase

clsCubeRole

MDStore

clsCube

clsMiningModelRole

MiningModel

clsMiningModel

Access

Read-only

Examples

Using ParentObject and ClassType properties

The following example creates a database role and assigns it to the roles collection of the first data mining model in the databases collection of mining models. It then prints some of the properties of that role's parent object by using the ParentObject property.

Dim dsoServer As New DSO.Server
Dim dsoDB As DSO.MDStore
Dim dsoDMM As DSO.MiningModel
Dim dsoDBRole As DSO.Role
Dim dsoDMMRole As DSO.Role

'Connect to the Analysis Server
  dsoServer.Connect "LocalHost"
  Set dsoDB = dsoServer.MDStores("FoodMart 2000")

'Get the first mining model
  Set dsoDMM = dsoDB.MiningModels(1)
  Debug.Print "MiningModel.Name = " & dsoDMM.Name
  
'Ensure the existence of TempRole in the database.
  Set dsoDBRole = dsoDB.Roles.AddNew("TempRole")
  
'Ensure the existence of a role.
  Set dsoDMMRole = dsoDMM.Roles.AddNew("TempRole")
  Debug.Print "MiningModel.Roles(""TempRole"").Name =" & _
    dsoDMM.Roles("TempRole").Name

'Print the roles .ParentObject properties
  Debug.Print "   .ParentObject properties" & vbCrLf & _
    "   -----------"
  Debug.Print "   TypeName(""dsoDMMRole.ParentObject"") = " & _
    TypeName(dsoDMMRole.ParentObject)
  If dsoDMMRole.ParentObject.ClassType = clsMiningModel Then
    Debug.Print "   .ClassType = clsMiningModel"
  Else
    Debug.Print "This line should never be executed."
  End If
  Debug.Print "   .Description = " & dsoDMMRole.ParentObject.Description
  Debug.Print "   .Name = " & dsoDMMRole.ParentObject.Name
  
  dsoDMM.Roles.Remove ("TempRole")
  dsoDB.Roles.Remove ("TempRole")

Voir aussi

Référence

Role Interface

Aide et Informations

Assistance sur SQL Server 2005