Partilhar via


Método SqlHierarchyId.GetAncestor

Retrieves the SqlHierarchyId node n levels up the hierarchical tree.

Namespace:  Microsoft.SqlServer.Types
Assembly:  Microsoft.SqlServer.Types (em Microsoft.SqlServer.Types.dll)

Sintaxe

'Declaração
<SqlMethodAttribute(DataAccess := DataAccessKind.None, SystemDataAccess := SystemDataAccessKind.None,  _
    InvokeIfReceiverIsNull := False, OnNullCall := False,  _
    IsDeterministic := True, IsPrecise := True, IsMutator := False)> _
Public Function GetAncestor ( _
    n As Integer _
) As SqlHierarchyId
'Uso
Dim instance As SqlHierarchyId 
Dim n As Integer 
Dim returnValue As SqlHierarchyId 

returnValue = instance.GetAncestor(n)
[SqlMethodAttribute(DataAccess = DataAccessKind.None, SystemDataAccess = SystemDataAccessKind.None, 
    InvokeIfReceiverIsNull = false, OnNullCall = false, 
    IsDeterministic = true, IsPrecise = true, IsMutator = false)]
public SqlHierarchyId GetAncestor(
    int n
)
[SqlMethodAttribute(DataAccess = DataAccessKind::None, SystemDataAccess = SystemDataAccessKind::None, 
    InvokeIfReceiverIsNull = false, OnNullCall = false, 
    IsDeterministic = true, IsPrecise = true, IsMutator = false)]
public:
SqlHierarchyId GetAncestor(
    int n
)
[<SqlMethodAttribute(DataAccess = DataAccessKind.None, SystemDataAccess = SystemDataAccessKind.None, 
    InvokeIfReceiverIsNull = false, OnNullCall = false, 
    IsDeterministic = true, IsPrecise = true, IsMutator = false)>]
member GetAncestor : 
        n:int -> SqlHierarchyId
public function GetAncestor(
    n : int
) : SqlHierarchyId

Parâmetros

  • n
    Tipo: System.Int32
    An integer representing the number of levels to ascend in the hierarchy.

Valor de retorno

Tipo: Microsoft.SqlServer.Types.SqlHierarchyId
SqlHierarchyId representing the nth ancestor of this.If a number greater than GetLevel is passed, nulluma referência nula (Nothing no Visual Basic) is returned.If a negative number is passed, an exception is raised indicating that the argument is out of range.

Consulte também

Referência

SqlHierarchyId Estrutura

Namespace Microsoft.SqlServer.Types