I want to populate a TreeView from SQL database.
I have a table with NODE_NAME AND PARENT_NODE columns and the child nodes should b created based on the PARENT_NODE.
How can I do this in vb.net?
I want to populate a TreeView from SQL database.
I have a table with NODE_NAME AND PARENT_NODE columns and the child nodes should b created based on the PARENT_NODE.
How can I do this in vb.net?
With your DataTable, you can try this method below. If it doesn't find the parent node, it adds it. The "Find" function returns an array of nodes, but in this case, it's assumed none or one node is always found:
You would use it by enumerating through the rows in your DataTable: