다음을 통해 공유


ParentObject (Role Interface)

[!참고]

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

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

참고 항목

참조