|
-
Sep 11th, 2000, 05:09 AM
#1
Thread Starter
New Member
Hi,
I want to pull the node names of the tree view from the database can anyone help me with this.
kanchan
-
Sep 11th, 2000, 05:21 AM
#2
Addicted Member
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
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
-
Sep 11th, 2000, 05:28 AM
#3
Thread Starter
New Member
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
-
Sep 11th, 2000, 05:34 AM
#4
Thread Starter
New Member
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
-
Sep 11th, 2000, 05:46 AM
#5
Addicted Member
OK,
Let's try this:
Code:
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
Hope this helps
Shaun
Web/Application Developer
VB6 Ent (SP5), Win 2000,SQL Server 2000
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|