ASP 递归调用 已知节点查找根节点的函数
程序员文章站
2022-03-14 10:49:57
复制代码 代码如下:function gettreerootid(pnodeid) getsql = "select note_id,parent_id from [t_t...
复制代码 代码如下:
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
上一篇: 七夕幽默谈感情