Please help me to populate a tree view from SQL database dynamically. I am very new to C# and step by step processes are welcome. I have two table formats given in the picture below and I want to fill the tree view from database accordingly. I searched on other resource sites also but didn't find the solution what I am looking for.
Please Help !!
Please view given image,
I suppose you have two choices
You either run a JOIN which will create a result from the db where the department name is repeated over and over, and the sub department name is unique; you then loop over this result set row by row with a logic of:
Or, you run two loops
In either case you'll need to query a db, so get that part working. Entity Framework will help if you want to use it
Also, look into adding nodes to a tree view and get familiar with it - don't need a db for this, just code it up by hand manually adding nodes for practice
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.