|
三级节点增加不了??请问哪里出问题??
Sub treeview_2() '二级节点,运行通过
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim nodindex As Node
Dim stracc As String
Dim acc As String
conn.Open "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\GAstore.mdb "
Set rs = New ADODB.Recordset
stracc = "select * from 类别 "
rs.Open stracc, conn, adOpenKeyset, adLockOptimistic
rs.MoveFirst
With rs
Do While Not .EOF
Set nodindex = TreeView1.Nodes.Add("A", tvwChild, "B" & rs.Fields("类别ID"), rs.Fields("类别"), 1, 4)
nodindex.Sorted = True
.MoveNext
Loop
End With
conn.Close
Set rs = Nothing
Set conn = Nothing
End Sub
--------------------------------------------------------------------------------------------------
Sub treeview_3() '三级节点,不能通过,,说没发现元素???
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim nodindex As Node
Dim stracc As String
Dim acc As String
acc = App.Path & "\GAstore.mdb"
conn.Open "provider=microsoft.jet.oledb.4.0;data source=" & acc
Set rs = New ADODB.Recordset
stracc = "select * from 明细类别 "
rs.Open stracc, conn, adOpenKeyset, adLockOptimistic
rs.MoveFirst
With rs
Do While Not .EOF
Set nodindex = TreeView1.Nodes.Add("B", tvwChild, "C" & rs.Fields("明细类别ID"), rs.Fields("明细类别"), 2, 3)
nodindex.Sorted = True
.MoveNext
Loop
End With
conn.Close
Set rs = Nothing
Set conn = Nothing
End Sub |
|