信息发布→ 登录 注册 退出

ASP 递归调用 已知节点查找根节点的函数

发布时间:2026-01-11

点击量:
复制代码 代码如下:
Function getTreeRootId(pNodeId)
getSQL = "select note_id,parent_id from [T_tree_demo] where note_id='"& pNodeId &"'"
Set getRs = db.Execute(getSQL)
If Not getRs.eof Then
If Trim(getRs("parent_id")) = "0" Then
getTreeRootId = Trim(getRs("note_id"))
Exit Function
Else
getTreeRootId = getTreeRootId(Trim(getRs("parent_id")))
End If
Else
getTreeRootId = 0
Exit Function
End If
getRs.close
Set getRs = Nothing
End Function
标签:# Function  # getRs  # db  # amp  # Set  # Execute  # Exit  # close  # eof  # Trim  # T_tree_demo  # ASP  # getTreeRootId  # span  # BR  # pNodeId  # note_id  # parent_id  # getSQL  # select  # 递归调用  
在线客服
服务热线

服务热线

4008888355

微信咨询
二维码
返回顶部
×二维码

截屏,微信识别二维码

打开微信

微信号已复制,请打开微信添加咨询详情!