7,786
社区成员
发帖
与我相关
我的任务
分享
dim cn as ADODB.connection, rs as ADODB.recordset
dim aLastNodes(4) as Node
dim i as long,j as long
...
set rs = cn.execute("selet * from test order by proname,JiZaiSgdw,Timin,Pronum2"
with treeview1.nodes
while not rs.eof
for i= 0 to 3 '找到哪级节点与上个纪录不同
if aLastNodes(i) is nothing then exit for
if aLastNodes(i).text <> rs(i).value then exit for
next
for j=i to 4
if j=0 then
set aLastNodes(j) = .Add(,,,rs(j).Value)
else
set aLastNodes(j) = .Add(aLastNodes(j-1).Index, tvwChild,,rs(j).Value)
end if
next
rs.movenext
wend
end with