关于treeview的node添加,帮我看看吧,谢了。

xiamei 2004-03-08 09:21:34
代码如下:
Private Sub Form_Load()
Dim nd As Node
Dim i As Integer
Dim j As Integer
Set nd = Tv1.Nodes.Add(, , "pj", "设备配件列表")
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Set rs1 = New ADODB.Recordset
rs1.Open "select distinct pjmc from basic", cn, 3, 1
rs1.MoveFirst
i = 1
Do While Not rs1.EOF
Set nd = Tv1.Nodes.Add("pj", tvwChild, "p" & i, rs1.Fields("pjmc"))
Set rs2 = New ADODB.Recordset
rs2.Open "select distinct guig from basic where pjmc = '" & nd.Text & "' ", cn, 3, 1
If Not rs2.EOF Then
rs2.MoveFirst
j = 1
Do Until rs2.EOF
Set nd = Tv1.Nodes.Add("p" & i, tvwChild, , rs2!guig)
rs2.MoveNext
j = j + 1
Loop
End If
Set rs2 = Nothing
rs1.MoveNext
i = i + 1
Loop
End Sub
...全文
49 点赞 收藏 6
写回复
6 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
相关推荐
发帖
VB基础类
创建于2007-09-28

7517

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2004-03-08 09:21
社区公告
暂无公告