tn-ks problem has been resolved.....
SQLTemp = "SELECT TbAccF.* FROM dbo.TbAccF "
cmd = New SqlCommand(SQLTemp, Conn)
If Conn.State = ConnectionState.Open Then Conn.Close()
Conn.Open()
dr = cmd.ExecuteReader
Dim dt As New DataTable("data")
dt.Load(dr)
Dim ds As New DataSet()
ds.Tables.Add(dt)
ds.Relations.Add("rsParentChild", ds.Tables("data").Columns("id"), ds.Tables("data").Columns("ParentId"))
For Each dr As DataRow In ds.Tables("data").Rows
If dr("ParentId") Is DBNull.Value Then
Dim root As New TreeNode(dr("AccNameAr").ToString())
root.Tag = dr("CodeID").ToString()
TreeView1.Nodes.Add(root)
PopulateTree(dr, root)
End If
Next
TreeView1.ExpandAll()
End Sub
Public Sub PopulateTree(dr As DataRow, pNode As TreeNode)
For Each row As DataRow In dr.GetChildRows("rsParentChild")
Dim cChild As New TreeNode(row("CodeID").ToString() & " : " & row("AccNameAr").ToString())
cChild.Tag = row("CodeID").ToString()
pNode.Nodes.Add(cChild)
PopulateTree(row, cChild)
Next
End Sub