About using DataSets

  • Thread starter Thread starter Willian F. Lopes
  • Start date Start date
W

Willian F. Lopes

Hi everybody!

I have some questions about using DataSets that I need some help? May you
help me? My questions:

1) What's the best practice: a DataSet from each form (a form could use 1 or
more if necessary) and I just load the necessary data on this form or a
unique DataSet for the all program (loading all the data)?

2) I'm affraid about memory resource: when I have a DataSet in my form when
the memory used by the DataSet will not be used anymore (free)? When I close
the form? Is it necessary a special code to free this memory?

3) How much DataSet I can have into my program?

4) The DataSet that are not in use (not in a loaded form) are using memory?

Thanks for attention,

Willian Lopes
 
Datasets are only as heavy as their contents. If you're filling the DataSet
with the contents of the entire database, yes memory can be an issue.
However, if the DataSet (DataTable) is focused on a small subset of rows
then it does not make much difference whether the dataset is global or local
to the form.

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
http://betav.com http://betav.com/blog/billva
____________________________________________________________________________________________
 
OK, so if I used a lot of DataSets, using only the necessary in each form,
is better then I use a only one with the full data?
 
William,

Some considerations:

First a dataset exist from a bunch of references to objects.
As you use one large dataset, you are almost direct in trouble as you start
updating, you will get concatination errors.
Count how much the objects your datasets needs. As you have no images (or
whater byte arrays) in it, then you will see mostly that used data never
reaches the values of all that multimedia you are most probebly
often/sometimes playing on your computer.

Cor
 
Back
Top