用深度遍历这颗数据库树
Function decomposeTree(fid,n)
dim strList
dim strIdList
dim zArr,zIdArr
if n>maxLeavel then Exit Function
strSQL="Select id,zitemid from work_bom where fitemid='" & fid & "'"
set rs=conn.Execute(strSQL) if not rs.eof then
strList=strList & rs("zitemid")
strIdList=strIdList & rs("id")
rs.movenext
while not rs.eof
strList=strList & "," & rs("zitemid")
strIdList=strIdList & "," & rs("id")
rs.movenext
wend
rs.close
set rs=nothing
zArr=split(strList,",")
zIdArr=split(strIdList,",")
for i=0 to UBound(zArr)
call AddItem(zIdArr(i),n+1)
call decomposeTree(zArr(i),n+1)
next
else
rs.close
set rs=nothing
end if
End Function
Function decomposeTree(fid,n)
dim strList
dim strIdList
dim zArr,zIdArr
if n>maxLeavel then Exit Function
strSQL="Select id,zitemid from work_bom where fitemid='" & fid & "'"
set rs=conn.Execute(strSQL) if not rs.eof then
strList=strList & rs("zitemid")
strIdList=strIdList & rs("id")
rs.movenext
while not rs.eof
strList=strList & "," & rs("zitemid")
strIdList=strIdList & "," & rs("id")
rs.movenext
wend
rs.close
set rs=nothing
zArr=split(strList,",")
zIdArr=split(strIdList,",")
for i=0 to UBound(zArr)
call AddItem(zIdArr(i),n+1)
call decomposeTree(zArr(i),n+1)
next
else
rs.close
set rs=nothing
end if
End Function
解决方案 »
- 有用Jcrop图片剪裁插件的么?遇到IE下图片缓存的问题
- javascript 如何控制excel生成chart图?
- iframe设置name的问题
- 如何知道框架中页面执行完毕,并且等待框架里面页面执行完毕再后执行后面代码
- 刚学javascript,做例题时运行不了
- 给解释一下这段代码?
- 实时记录访客浏览的页面。
- 如何让一个select的值控制另一个select是否可选?我这样做的,可不行。哪位能帮我?谢谢!
- 为什么不反应?function window::onload(){alert("正在下载")}
- 关于在IE6中无法运行IEWebBrowser组件的execWB方法
- 请问用什么办法可以取代onclick???
- 以为Jscript 就是Javascript 下载了好多书,发现JScript是MS的???是吗???恶心的MS
walksing.ku.net 本服务器开机时间:(周一--周五) [8:40--18:30] .