i am trying to generate a tree view from database, but i after 10 days, i could not fine any way, how to populate, i have tried alot...
please help me...
i have 2 tables of database..
i contains the parent nodes, and other contain the child node..
e.g

first table. CC_ATTRIBUTE.  (Which Contains Child Node)                          

CC_Id 	Description   	CC_Attribute_Type_Id
1	Diamond	            1
2	Gold	            1
3	Silver	            1
4	Bronze	            1
5	High	            2
6	Meduim	            2
7	Low	            2
8	Exclusive	    3
9	Mix	            3
10	Key Acount	    3
11	PCI 	            3
12	Coke	            3
13	Traditional Store   4
14	Modern General Store4
15	Bakery	            4


2nd Table...
CC_Attribute_type (Which Contains Parent Nodes)

CC_Attribute_type_id	Description
1	                  Sales Status
2	                  Socio Economic Status
3	                  Outlet Status
4	                  Outlet Classification


please help me...

Edited 5 Years Ago by Jaseem Ahmed: n/a

i have seen this, this is not help full to me...
in this tree a to z nodes are populates, and then Asssecdingly they work,, i dont want this, i want to make 4 parent nodes, and according to thier keys, childs should b settled in parents...i have tried for parent...all the parent nodes are coming, but i m unable to call child...

Dim dbCon As New ADODB.Connection
Dim rs As New ADODB.Recordset

Private Sub Form_Load()
Dim node1,node2 As Node
Set node1 = TreeView1.Nodes.Add(, , , "Classification")
TreeView1.Nodes(1).Key = "node1"
dbCon.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ISIS_157;Data Source=JASEEMAHMED"
rs.Open "SELECT * FROM CC_ATTRIBUTE_TYPE_ID", dbCon, adOpenDynamic, adLockOptimistic
TreeView1.Checkboxes = True
rs.MoveFirst

While Not rs.EOF
Set node2 = TreeView1.Nodes.Add(node1, tvwChild, , rs.Fields("Description"))
TreeView1.Nodes(2).Key = "node2"
rs.MoveNext
Wend
rs.Close
Set node3 = TreeView1.Nodes.Add(node2, tvwChild, "node3", "jaseem")'this is a child node, which should b in 1st parent,but it is showing in last parent.
End Sub

Edited 5 Years Ago by Jaseem Ahmed: n/a

As i said that is a sample piece code not designed to suit your exact requirement.

Modify that to fit your needs.

The nodes are A to Z because the sample code populated the employee names. And the names are added as per the First character to the corresponding node.

that is not helpfull to me....the sample u have shown me, i have already developed, the code is above written, my problem is not have alook at sample....and that sample contains 1 table, whcih i can do easily....but i have two tables.

Edited 5 Years Ago by Jaseem Ahmed: n/a

Comments
that code was not to spoon feed you.

If you have multiple tables, you need to link both.

populate the parent nodes from the master table and then the child node from the child table. You need to join the parent and child table to fetch the child node records.

This article has been dead for over six months. Start a new discussion instead.