SqlHierarchyId.GetAncestor 方法 (Int32)

 

在层次结构树中向上检索 SqlHierarchyId 节点 n 个级别。

命名空间:   Microsoft.SqlServer.Types
程序集:  Microsoft.SqlServer.Types(位于 Microsoft.SqlServer.Types.dll)

语法

[SqlMethodAttribute(DataAccess = DataAccessKind.None, SystemDataAccess = SystemDataAccessKind.None, 
    InvokeIfReceiverIsNull = false, OnNullCall = false, IsDeterministic = true, 
    IsPrecise = true, IsMutator = false)]
public SqlHierarchyId GetAncestor(
    int n
)
public:
[SqlMethodAttribute(DataAccess = DataAccessKind::None, SystemDataAccess = SystemDataAccessKind::None, 
    InvokeIfReceiverIsNull = false, OnNullCall = false, IsDeterministic = true, 
    IsPrecise = true, IsMutator = false)]
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
<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

参数

  • n
    Type: System.Int32

    一个整数,表示在层次结构中上升的级别数。

返回值

Type: Microsoft.SqlServer.Types.SqlHierarchyId

表示 this 的第 n 个祖先的 SqlHierarchyId

如果传递的数字大于 GetLevel,则返回 null

如果传递的是负数,则将引发异常,指示该参数超出范围。

另请参阅

SqlHierarchyId 结构
Microsoft.SqlServer.Types 命名空间

返回页首