sql server - Populate Treeview from Datatable -


i have sql table (called tblclosure) has these fields:

  1. locationid
  2. locationdesc
  3. parentid

my question how can populate treeview control datatable in winforms/vb? have seen examples in c# i'm rookie coder , having difficulties adapting code.

any appreciated.

thanks in advance

if having 2 levels of hierarchy of data, suggest using gridview control instead , bind datatable results query this

select   case when parentid>0 parentid else locationid end theparentid  ,locationid  ,locationdesc  ,parentid  tblclosure    order 0, parentid, locationdesc 

then based on value of parentid style differently show if parent or child row.

check http://sqlfiddle.com/#!2/b29b8/2/0


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -