G
Guest
I have a table that has two columns, Parent and Child. I'm able to populate
a IEControls treeview with the Parent column. On the same row as the Parent
is the child in the Child colum. How do add the subnodes from the Child
column? Here's what I have so far. Thanks in advance.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim Tn As TreeNode
Dim CH As TreeNode
Dim DA As OleDb.OleDbDataAdapter
Dim ds As DataSet
Dim DR As DataRow
Dim DR2 As DataRow
'Create the Connection object and the DataSet object,
'and then open the connection.
MyConnection = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=C:\Inetpub\wwwroot\intelis.MDB")
MyCommand = New System.Data.OleDb.OleDbDataAdapter( _
"select DISTINCT Parent, Child from Entity",
MyConnection)
ds = New DataSet
'Add an ENTITY table to the DataSet.
MyCommand.Fill(ds, "ENTITY")
'Populate the TreeView from the DataSet.
For Each DR In ds.Tables("ENTITY").Rows
Tn = New TreeNode
Tn.Text = DR("PARENT")
Tn.NodeData = DR("PARENT")
Tn.Expandable = ExpandableValue.CheckOnce
TreeView1.Nodes.Add(Tn)
Next
'Clean up.
ds.Dispose()
' DA.Dispose()
MyConnection.Close()
MyConnection.Dispose()
End If
End Sub
a IEControls treeview with the Parent column. On the same row as the Parent
is the child in the Child colum. How do add the subnodes from the Child
column? Here's what I have so far. Thanks in advance.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim MyConnection As System.Data.OleDb.OleDbConnection
Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
Dim Tn As TreeNode
Dim CH As TreeNode
Dim DA As OleDb.OleDbDataAdapter
Dim ds As DataSet
Dim DR As DataRow
Dim DR2 As DataRow
'Create the Connection object and the DataSet object,
'and then open the connection.
MyConnection = New System.Data.OleDb.OleDbConnection( _
"provider=Microsoft.Jet.OLEDB.4.0; " & _
"data source=C:\Inetpub\wwwroot\intelis.MDB")
MyCommand = New System.Data.OleDb.OleDbDataAdapter( _
"select DISTINCT Parent, Child from Entity",
MyConnection)
ds = New DataSet
'Add an ENTITY table to the DataSet.
MyCommand.Fill(ds, "ENTITY")
'Populate the TreeView from the DataSet.
For Each DR In ds.Tables("ENTITY").Rows
Tn = New TreeNode
Tn.Text = DR("PARENT")
Tn.NodeData = DR("PARENT")
Tn.Expandable = ExpandableValue.CheckOnce
TreeView1.Nodes.Add(Tn)
Next
'Clean up.
ds.Dispose()
' DA.Dispose()
MyConnection.Close()
MyConnection.Dispose()
End If
End Sub