Udostępnij za pośrednictwem


ParentObject (polecenie Interface)

Ostrzeżenie

  Ta funkcja zostanie usunięta z następnej wersji programu Microsoft SQL Server. Nie należy stosować tej funkcji w nowych projektach oraz jak najszybciej należy zmodyfikować aplikacje, w których obecnie jest używana ta funkcja.

ParentObject Właściwość zwraca odwołanie do interfejs domyślnego obiektu nadrzędnego.

Stosuje się do:clsCubeCommand, clsDatabaseCommand, clsRoleCommand

Typ danych

Obiekt

Dostęp

Tylko do odczytu

Uwagi

Właściwość ta zwraca interfejs domyślnego dla nadrzędnego obiektu polecenie.Dla obiektów, których ClassType właściwość jest clsRoleCommand, właściwość ta zwraca obiekt ClassType clsCubeRole lub clsDatabaseRole.

Zwracany obiekt i jego typ klasy zależą od typu klasy bieżącego obiektu polecenie.

Typ klasy

Interfejs obiektu nadrzędnego

Typem klasy obiektu nadrzędnego

clsDatabaseCommand

MDStore

clsDatabase

clsCubeCommand

MDStore

clsCube

clsRoleCommand

Role

clsDatabaseRoleclsCubeRoleclsMiningModelRole

Przykład

Poniższy przykład porównuje korzystanie z Parent właściwość z ParentObject właściwość:

Dim dsoDB As DSO.MDStore
Dim dsoRole As DSO.Role
Dim dsoRoleCmd As DSO.Command
Dim dsoDatabaseRole As DSO.Role

  dsoServer.Connect "LocalHost"
  Set dsoDB = dsoServer.MDStores("FoodMart 2000")

'Get the first role in the database.
'This should be the Everyone role.
  Set dsoRole = dsoDB.Roles(1)

  Debug.Print "DatabaseRole.Name = " & dsoRole.Name
'Add a new command to the role.
  Set dsoRoleCmd = dsoRole.Commands.AddNew("RoleCmd")
  
  'Print the properties of the Parent object.
  Debug.Print ".Parent properties" & vbCrLf & "---------"
  Debug.Print "Interface type = " & TypeName(dsoRoleCmd.Parent)
  If dsoRoleCmd.Parent.ClassType = clsDatabase Then
    Debug.Print ".ClassType = clsDatabase"
  Else
    Debug.Print "This should never be printed."
  End If
  Debug.Print ".Description = " & dsoRoleCmd.Parent.Description
  Debug.Print ".Name = " & dsoRoleCmd.Parent.Name

'Print the properties of the ParentObject object
  Debug.Print ".ParentObject properties" & vbCrLf & "---------"
  Debug.Print "Interface type = " & TypeName(dsoRoleCmd.ParentObject)
  Set dsoDatabaseRole = dsoRoleCmd.ParentObject
  If dsoDatabaseRole.ClassType = clsDatabaseRole Then
      Debug.Print ".ClassType = clsDatabaseRole"
  Else
    Debug.Print "This should never be printed."
  End If
  Debug.Print ".ClassType = " & dsoDatabaseRole.ClassType
  Debug.Print ".Description = " & dsoDatabaseRole.Description
  Debug.Print ".Name = " & dsoDatabaseRole.Name

Zobacz także

Odwołanie