What is the best way to load this tree (c# & sql question)

D

D

Say you have three tables apples, oranges and bananas and each table has a
different amount of fields that are obviously particular to that type of
fruit. Now I want to load them into a form based tree control with each
table having it's own separate node.

In the tree load function what I did was create three sql data readers and
manually iterate through adding the nodes and related info. While this works
I was wondering if there was a better method.

I was playing around with this code sample from codeproject.com where the
author sets the tree's data source to a dataview and creates node grouping
but that cannot apply here because there can only be one data source for the
tree and not three connected to the three primary nodes (apples, oranges and
bananas) And second it won't work because I don't have a sql statement
that'll return a single set of data that contains all of the data. I tried
unions but due to the unequal amount of fields it's not working out for me.

So is what I've done good enough?

Thanks
 
A

Alvin Bruney [ASP.NET MVP]

sounds good enough to me on the surface. If you are worried about
performance and memory, then one good approach is to use a weak reference to
hold the tree in memory. That will economize on memory space and load time.
You can find more about weakreference on MSDN.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top