treeview控件访问时,一般按什么来取,例如;想让根据父节点连接上不同的数据表,该怎样编写?
Set lsv1.DataSource = ado1
Set nodx1 = trv1.Nodes.Add(, , "tyre", "工程机械轮胎")
nodx1.Expanded = False
Set nodx2 = trv1.Nodes.Add(, , "bridge", "工程机械桥")
nodx2.Expanded = Tru
if node.parents.name="工程机械轮胎" then
Set ado1 = New ADODB.Recordset
ado1.Open "select distinct 样式 from 工程机械轮胎 ", conn
ado1.MoveFirst
Do While Not ado1.EOF
trv1.Nodes.Add "tyre", tvwChild, , ado1.Fields("样式")
ado1.MoveNext
Loop
ado1.Close
Set ado1 = Nothing
Set ado1 = New ADODB.Recordset
ado1.Open "select * from 工程机械轮胎 ", conn
Set lsv1.DataSource = ado1
elseif node.parents.name="工程机械桥" then
.....
....
.....
end if
是这样编写吗?还是用nodes.parents.key?????? 错误:要求对象???
Set lsv1.DataSource = ado1
Set nodx1 = trv1.Nodes.Add(, , "tyre", "工程机械轮胎")
nodx1.Expanded = False
Set nodx2 = trv1.Nodes.Add(, , "bridge", "工程机械桥")
nodx2.Expanded = Tru
if node.parents.name="工程机械轮胎" then
Set ado1 = New ADODB.Recordset
ado1.Open "select distinct 样式 from 工程机械轮胎 ", conn
ado1.MoveFirst
Do While Not ado1.EOF
trv1.Nodes.Add "tyre", tvwChild, , ado1.Fields("样式")
ado1.MoveNext
Loop
ado1.Close
Set ado1 = Nothing
Set ado1 = New ADODB.Recordset
ado1.Open "select * from 工程机械轮胎 ", conn
Set lsv1.DataSource = ado1
elseif node.parents.name="工程机械桥" then
.....
....
.....
end if
是这样编写吗?还是用nodes.parents.key?????? 错误:要求对象???
'