I am trying to load nodes into a c# winform treeview using System.Data.SQLite.
Currently my database table looks like this:
ID Parent_ID Name
1 0 Apple
2 0 Pear
3 2 Grapes
4 3 Banana
I need my treeview to look like this:
Apple
Pear
-> Grapes
-> -> Banana
'Grapes' has a Parent_ID of '2', making it a child node of 'Pear', and 'Banana' has a Parent_ID of '3', making it a child node of 'Grapes'.
I'm not very experienced with SQL and am not sure how to go about getting the data out of my SQLite file 'Database.db', containing a table 'MyTable'.
Any help is much appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…