I have been trying for a while to get his to work. I have a table that list the root folder, sub-folders and reports in a database. I am trying to bind this to a TreeView in a windows form
My raw data looks like this
This is what I am trying to end up with.
I need this to be based on what the query returns from the DB. I got the connection and dt portion build just hang a hard time getting this to go from datatable to treeview
Also I can change the qury to how ever it should be to facilitate the treeview.
Any assistance is appreciated.
RJL
My raw data looks like this
Code:
Type IDParent NameParent ReportName
Root NULL Management Reports NULL
Folder 0 Inbound NULL
Report 1 NULL Inbound Report 1
Report 1 NULL Inbound Report 2
Folder 0 Labor NULL
Report 1 NULL Labor Report 1
Report 1 NULL Labor Report 2
Report 1 NULL Labor Report 3
Folder 0 Outbound NULL
Report 1 NULL Outbound Report 1
Folder 0 Packaging NULL
Report 1 NULL Packaging Report 1
Folder 0 Statistics NULL
Report 1 NULL Statistics Report 1
Report 1 NULL Statistics Report 1
This is what I am trying to end up with.
Code:
+ Management Reports
+ Inbound
Inbound Report 1
Inbound Report 2
+ labor
Labor Report 1
Labor Report 2
Labor Report 3
+ Outbound
Outbound Report 1
+ Packaging
Packaging Report 1
+ Statistics
Statistics Report 1
Statistics Report 1
I need this to be based on what the query returns from the DB. I got the connection and dt portion build just hang a hard time getting this to go from datatable to treeview
Code:
DataTable dt = new DataTable();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "SSRS_TREE_VIEW_LIST";
cmd.CommandType = CommandType.StoredProcedure;
cs.Open();
cmd.Connection = cs;
cmd.ExecuteNonQuery();
cs.Close();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
da.Fill(dt);
Also I can change the qury to how ever it should be to facilitate the treeview.
Any assistance is appreciated.
RJL