Public Transtr As String
Public index As IntegerFunction Treeview_Display()
Dim rs_tmp As New ADODB.Recordset
Dim tmpsql As Stringindex = 1
TreeView1.Nodes.Add , tvwLast, , "[客户一览表]"tmpsql = "select distinct industry from tbl_company"
rs_tmp.Open tmpsql, conn, adOpenKeyset, adLockOptimisticDo While Not rs_tmp.EOF
TreeView1.Nodes.Add 1, tvwChild, , "[行业/产业链] " & rs_tmp.Fields(0)
Transtr = rs_tmp.Fields(0)
Treeview2_Display
index = index + 1
rs_tmp.MoveNext
Looprs_tmp.Close
End FunctionFunction Treeview2_Display()Dim rs_tmp2 As New ADODB.Recordset
Dim tmpsql2 As Stringtmpsql2 = "select com_name from tbl_company where industry='" & Trim(Transtr) & "'"
rs_tmp2.Open tmpsql2, conn, adOpenKeyset, adLockOptimisticDo While Not rs_tmp2.EOF
TreeView1.Nodes.Add index, tvwChild, , rs_tmp2.Fields(0) rs_tmp2.MoveNext
Looprs_tmp2.Close
End Function
TreeView1.Nodes.Add "根目录", tvwChild, "根目录_子目录1", "子目录1"
TreeView1.Nodes.Add "根目录", tvwChild, "根目录_子目录2", "子目录2"
TreeView1.Nodes.Add "根目录_子目录1", tvwChild, "根目录_子目录1_文件1", "文件1"
TreeView1.Nodes.Add "根目录_子目录1", tvwChild, "根目录_子目录1_文件2", "文件2"
TreeView1.Nodes.Add "根目录_子目录2", tvwChild, "根目录_子目录2_文件1", "文件1"
TreeView1.Nodes.Add "根目录_子目录2", tvwChild, "根目录_子目录2_文件2", "文件2"