I don't know what format the treeview expects. If you show a small example and your table(s) structure I'll try to help.
You'll need to do a normal select query but modify it by adding FOR XML at the end, possibly with other options too. See SQLXML in the sql server books online.
--
Joe (
Microsoft MVP - XML)