which way is better

Posted on 2006-06-04
Medium Priority
Last Modified: 2010-04-16
I am new to c#. I was wondering with ado.net. is it better to open a dataset and include all your tables in it, and then just create bindings, and tableadapters on the fly, or is it better to have an empty dataset and load up the tables as needed. I am trying to figure out if I pull in everything at once and then filter inside of my code etc..
What is the standard way it is normally done.
Question by:ppearson3000

Expert Comment

ID: 16829322
I wouldn't load up all the tables into a DataSet when your program starts because you would have 10000 tables.  I would only load up what you need for that given time.  This question is a little bit tricky, you can only answer it.  Depending on what you are doing, sometimes it's better to pull back more tables than you need because you know very likely the user will ask for it anyways.  In general, I would pull back only the data you need for now, if that becomes a performance issue, just try to fine tune it by pulling the data differently.

For example, if you UI shows all the users in the system, I would only pull back users table.  When the user clicks on another section to show the inventory, I would pull back the desired inventory there.  At any time, I wouldn't pull back everything only pull back what the user asked for.  If the user didn't filter it, I would try to page it.



Accepted Solution

paltareq earned 60 total points
ID: 16829391
the best way test the beter of (dataset  / dataset and load )
run the first and second with cpu monitoring

then see which is have smallest time to process task and size in ram


Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question