Hi,
I want to pull the node names of the tree view from the database can anyone help me with this.
kanchan
Printable View
Hi,
I want to pull the node names of the tree view from the database can anyone help me with this.
kanchan
Hi,
What is the structure of the database that you need to put in a treeview? (ie. Roots,children etc...).
With a bit more info I might be able to help ;)
Shaun
Hi,
I want to display first node as PROJECT and its child OBJECTS and further its child ATTRIBUTES and these should be editable as these r going to interact with the database.
Am i clear??????
Kanchan
Hi,
The structure of my database is
1)Project table
i)Pro_id
ii)Pro_desc
2)Object Table
i)Object_id
ii)Object_desc
iii)Pro_id
3)Attribute table
i)attr_id
ii)attr_desc
iii)object_id
i hope i am clear this time
Kanchan
OK,
Let's try this:
Hope this helpsCode:Dim TVX As Node
Dim tvNode As Nodes
Dim RST as ADODB.Recordset 'or whatever DB connection type you are using
'Get a record set of the Project table (I assume you can do this
'Populate the treeview with it's parents
If Not RST.EOF Then
Do While Not RST.EOF
Set TVX = tvNode.Add(, , "Parent" & CStr(RST("Pro_id")), RST("Pro_Desc"))
RST.MoveNext
Loop
End IF
RST.Close
'Populate the children of Parents (With Object table)
'Get a recordset of the object table
If Not RST.EOF Then
Do While Not RST.EOF
Set TVX = tvNode.Add("Parent" & Cstr(RST("Pro_id")),tvwChild,"Object" & Cstr(RST("Object_id")),RST("Object_desc"))
RST.MoveNext
Loop
End If
RST.Close
'Populate the children of the Objects (With Attribute table)
'Get a recordset of the Attribute table
If Not RST.EOF Then
Do While Not RST.EOF
Set TVX = tvNode.Add("Object" & Cstr(RST("Object_id")),tvwChild,"Attrib" & Cstr(RST("attr_id"),RST("attr_desc"))
RST.MoveNext
Loop
End If
RST.Close
Set RST = Nothing
Shaun