|
-
Jul 11th, 2007, 01:15 PM
#2
I wonder how many charact
Re: [2.0] there has to be a better way to do this.
 Originally Posted by Crash893
Hi all
I want to make a sub that i send a Query and maybe some other variables (server location and table name) and i want it to return a datatable in a dataset that i can then feed into other subs for data manipulation as well as fill a DGV
the question is , if i have the sub return as a dataset how can i do more than one thing with it with out having to re run the sub again and again.
is it efficient to do something like "Dataset DS = subprocdure(query)" and then use DS in my code and if i do this wont it cause a duplication of data? (basicly ill have two containers sitting in memory)
Here is my code ( and please PLEASE feel free to correct anything else you think should be improved)
Ps yes i know the sub is names stupid thats just while im playing with it
c# Code:
private void button2_Click(object sender, EventArgs e)
{
publisherObjectController = PublisherObjectController.Create();
publisherObjectController.Load();
}
Put your Test method in a separate class. Rename the method to Load().
Then you can truly use it anywhere.
As far as calling the sub again and again:
It comes down to how many times you expect to get the same data. If the data will stay the same between calls, you may want to load it once and cache it. If the data changes, there's no point in caching.
Last edited by nemaroller; Jul 11th, 2007 at 01:19 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|