PC Review


Reply
Thread Tools Rate Thread

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

 
 
D
Guest
Posts: n/a
 
      20th Mar 2005
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


 
Reply With Quote
 
 
 
 
Alvin Bruney [ASP.NET MVP]
Guest
Posts: n/a
 
      21st Mar 2005
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
_________________________


"D" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A tree question Taffycat General Discussion 47 13th Dec 2008 12:54 PM
tree question richard Windows XP Basics 5 20th Mar 2006 01:44 AM
Load Tree View from Configuration Block niteshs@yahoo.com Microsoft Dot NET Framework 1 28th Nov 2005 08:38 AM
Error: Failed to load viewstate. The control tree into =?Utf-8?B?Sm9zZW1h?= Microsoft C# .NET 0 9th May 2005 11:56 AM
Windows Explorer directory tree pane fails to load MB Microsoft Windows 2000 Applications 3 10th Oct 2003 04:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:55 AM.