How to load dataset tables in treenode?

If user wants to create treenode which has different tables alongwith treenode column names and its datatype then this code will be used. You can also add gridview control in your form and add datatable as its datasource to get all the data under a particular column.

How to load dataset tables in treenode?
Method description:
myRoot represents root node which is "DATASET TABLES". mytblchild represent table name.
mycolchild represents column name and myDatatypechild represents datatype of column.

private void display_data_from_datasetTables_To_Treenode()
lstDataset.LabelEdit = false;
lstDataset.ImageList = imageList1;
TreeNode myRoot = new TreeNode("DATASET TABLES", 0, 0);
TreeNode mytblchild;
foreach (DataTable dtTable in ds.Tables)
mytblchild = new TreeNode(dtTable.TableName.ToUpper(), 1, 2);
TreeNode mycolchild, myDatatypechild;
foreach (DataColumn dcColumn in dtTable.Columns)
mycolchild = new TreeNode(dcColumn.ColumnName.ToUpper(), 3, 3);
myDatatypechild = new TreeNode(dcColumn.DataType.ToString(), 4, 4);

lstDataset.LabelEdit = true;



No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: