DataSets

When do the DataSets created as a project Datasource get read: When the specific form that utuilzies it requests the infroamtion or when the application is started?

Are these good to use or should I use another form to access the SQL Server data? This will be a multiuser apps if that makes a difference.

Thanks
sneeri_cAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

whatsit2002Commented:
Datasets get filled when you call the .Fill() method on the adapter you are using. DataSets and DataAdapters are very good for accessing SQL Server data. The only downside to them is they are a little "fat" for serialization or the transfer of small amounts of data (one, two, three records at a time). They add some bulk to your data, but that is of little consequence when your dataset is already large because of the advantages they offer in return.

For smaller amounts of data, I usually use custom classes, but that's just my preferrence.

Thanks.

Jason

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
anarki_jimbelSenior DeveloperCommented:
You may also use DaraReader, e.g. Especially if you need only read acces - it greatly improves performance (quite important for multiuser);


FROM MS:
=========================================================
Choosing a DataReader or a DataSet
When deciding whether your application should use a DataReader (see Retrieving Data Using the DataReader) or a DataSet (see Using DataSets in ADO.NET), you should consider the type of functionality that your application requires. Use a DataSet to do the following:

Cache data locally in your application so that you can manipulate it. If you only need to read the results of a query, the DataReader is the better choice.

Remote data between tiers or from an XML Web service.

Interact with data dynamically such as binding to a Windows Forms control or combining and relating data from multiple sources.

Perform extensive processing on data without requiring an open connection to the data source, which frees the connection to be used by other clients.

If you do not require the functionality provided by the DataSet, you can improve the performance of your application by using the DataReader to return your data in a forward-only, read-only fashion. Although the DataAdapter uses the DataReader to fill the contents of a DataSet (see Populating a DataSet from a DataAdapter), by using the DataReader you can boost performance because you will save memory that would be consumed by the DataSet, as well as avoid the processing required to create and fill the contents of the DataSet.
sneeri_cAuthor Commented:
Both of you thanks for the info.

Jason, when does it free up the memory it utilizes after the DataSets area filled.

Thanks
whatsit2002Commented:
Like most of the objects in .NET, the garbage collector has control over that, so you cannot pinpoint an exact time, but when the object is Dispose() 'd, you can pretty much guarantee you're going to get the memory back.

Thanks.

Jason
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.