Parent (Role Interface)
[!REMARQUE]
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 Parent property of the Role interface contains a reference to the parent MDStore object.
Applies To:clsCubeRole, clsDatabaseRole, clsMiningModelRole
Data Type
The ClassType value of the returned object depends on the value of the ClassType property of the object.
Class type |
Returned object class type |
---|---|
clsDatabaseRole |
|
clsCubeRole |
|
clsMiningModelRole |
Nothing |
Access
Read-only
Notes
This property will return Nothing for mining model roles, because data mining models do not support the MDStore interface. To obtain the parent object of a mining model role, use the ParentObject property.
Examples
Using the Parent and ClassType properties
The following example creates a database role and assigns it to the first cube in the database object's collection of cubes. It then prints some of the properties of the parent object by using the role object's Parent property.
Dim dsoServer As New DSO.Server
Dim dsoDB As DSO.MDStore
Dim dsoCube As DSO.MDStore
Dim dsoDBRole As DSO.Role
Dim dsoCubeRole As DSO.Role
'Connect to the Analysis Server
dsoServer.Connect "LocalHost"
Set dsoDB = dsoServer.MDStores("FoodMart 2000")
'Get the first cube in the database's collection
Set dsoCube = dsoDB.MDStores(1)
Debug.Print "Cube.Name = " & dsoCube.Name
'Ensure the existence of TempRole in the database.
Set dsoDBRole = dsoDB.Roles.AddNew("TempRole")
'Add the command to cube's collection of commands.
Set dsoCubeRole = dsoCube.Roles.AddNew("TempRole")
Debug.Print "Cube.Roles(""TempRole"").Name =" & _
dsoCube.Roles("TempRole").Name
'Print the roles .ParentObject properties
Debug.Print " .Parent properties" & vbCrLf & _
" -----------"
Debug.Print " TypeName(""dsoCubeRole.Parent"") = " & _
TypeName(dsoCubeRole.Parent)
If dsoCubeRole.Parent.ClassType = clsCube Then
Debug.Print " .ClassType = clsCube"
Else
Debug.Print "This line should never be executed."
End If
Debug.Print " .Description = " & dsoCubeRole.Parent.Description
Debug.Print " .Name = " & dsoCubeRole.Parent.Name
dsoCube.Roles.Remove ("TempRole")
dsoDB.Roles.Remove ("TempRole")