ParentObject (Role Interface)
Hinweis: |
---|
Dieses Feature wird in der nächsten Version von Microsoft SQL Server entfernt. Verwenden Sie dieses Feature nicht zum Entwickeln neuer Anwendungen, und planen Sie das Ändern von Anwendungen, in denen es zurzeit verwendet wird, zum frühstmöglichen Zeitpunkt ein. |
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 |
|
clsCubeRole |
MDStore |
|
clsMiningModelRole |
MiningModel |
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")