다음을 통해 공유


Parent (Role Interface)

[!참고]

  이 기능은 다음 버전의 Microsoft SQL Server에서 제거됩니다. 새 개발 작업에서는 이 기능을 사용하지 말고, 현재 이 기능을 사용하는 응용 프로그램은 가능한 한 빨리 수정하십시오.

The Parent property of the Role interface contains a reference to the parent MDStore object.

Applies To:clsCubeRole, clsDatabaseRole, clsMiningModelRole

Data Type

MDStore

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

clsDatabase

clsCubeRole

clsCube

clsMiningModelRole

Nothing

Access

Read-only

주의

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")