do you want how get the data from DB or hard-code the data to tree listview?
first load data as usual from sql-server, assume you know how to search a hierarchical data.
then get the root node data and added to the tree view items. last add each node children one by one.
public void LoadTree(TreeNode parentNode)
{
string path = parentNode.Tag as string;
foreach (string drv in System.IO.Directory.GetFiles(path))
{
TreeNode driverNode = new TreeNode(drv);
driverNode.Tag = drv;
driverNode.Nodes.Clear();
parentNode.Nodes.Add(driverNode);
}
foreach (string drv in System.IO.Directory.GetDirectories(path))
{
TreeNode driverNode = new TreeNode(drv);
driverNode.Tag = drv;
driverNode.Nodes.Clear();
parentNode.Nodes.Add(driverNode);
}
}
private void button1_Click(object sender, EventArgs e)
{
foreach (System.IO.DriveInfo drv in System.IO.DriveInfo.GetDrives())
{
TreeNode driverNode = new TreeNode(drv.Name);
driverNode.Tag = drv.Name;
driverNode.Nodes.Clear();
LoadTree(driverNode);
this.treeView1.Nodes[0].Nodes.Add(driverNode);
}
}