论坛风格切换
您好,欢迎光临本站!   登录 注册新用户
  • 2918阅读
  • 0回复

[asp]ASP 递归调用 已知节点查找根节点的函数 [复制链接]

上一主题 下一主题
 

发帖
16250
黑豆
-2
威望
45224
贡献值
2
交易币
0
红豆
0
只看楼主 倒序阅读 0 发表于: 2013-11-24
已知节点查找根节点的asp函数


复制代码代码如下:

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


快速回复
限100 字节
 
上一个 下一个