String conObj = ConfigurationManager.ConnectionStrings["serverConfig"].ConnectionString;
SqlConnection con=new SqlConnection(conObj);
SqlDataAdapter da = new SqlDataAdapter("usp_Acc_getAccountGroups", con);
// da.SelectCommand.CommandType = CommandType.StoredProcedure;
DataSet ds = new DataSet();
da.Fill(ds);
ds.Relations.Add("ChildRows", ds.Tables[0].Columns["ChartAcct_Id"], ds.Tables[0].Columns["Parent_Account"]);
foreach (DataRow level1DataRow in ds.Tables[0].Rows)
{
TreeNode parentTreenode = new TreeNode();
parentTreenode.Text = level1DataRow["Acc_Name"].ToString();
DataRow[] childRows = level1DataRow.GetChildRows("ChildRows");
f ...
Go to the complete details ...