sql1 = "select distinct 类别 from MES102 order by 类别"
Set rs1 = conn.Execute(sql1)
Do While Not rs1.EOF
Set a1 = TreeView1.Nodes.Add("系统作业清单", tvwChild, , Trim(rs1("类别")), 2, 2)
'a1.EnsureVisible '保证程序开始的时候节点是闭合的
Set rs2 = conn.Execute("select * from MES102 where 类别='" & Trim(rs1("类别")) & "' order by 名称")
If Not rs2.EOF Then
Do While Not rs2.EOF
Set a2 = TreeView1.Nodes.Add(a1, tvwChild, Trim(rs2("窗体")), Trim(rs2("名称")), 3, 3)
rs2.MoveNext
Loop
End If
rs1.MoveNext
Loop