I know that DataSets are like a "copy" in memory from the database. So,
there is a logic that I don´t understand: do I have to use a lot of
DataSets? If yes, when this DataSets will release theyre used memory? If I
used typed DataSets, when they update the database?

Thanks,

Willian.

Re: Using DataSets... by Cowboy

Cowboy
Fri May 09 08:28:42 CDT 2008


"Willian Lopes" <willian@transespecialista.com.br> wrote in message
news:24477E8D-CE48-445F-8AEC-1487E0C4D4BE@microsoft.com...
>I know that DataSets are like a "copy" in memory from the database.

They are similar, in that they can hold much of the structure, but the
"database in memory" metaphor/analogy can get you into trouble if you cling
to all of the implications.

>So, there is a logic that I don´t understand: do I have to use a lot of
>DataSets?

There are two predominant theories here. The first is to create a DataSet
for each of the functions you use (or one that can span multiple functions).
For each operation, you may only have one DataSet going, but it leads to
many.

The other is to create one or more "master" DataSets and only fill the
tables you need to fill. You see this in some ORM products.

The direction you choose depends on how you wish to view your application(s)
more than how the application(s) actually work.

>If yes, when this DataSets will release theyre used memory?

Like any .NET object, a DataSet will mark itself as available for the
garbage collector when it is either a) explicitly destroyed or b) falls out
of scope. This is an oversimplification of course.

>If I used typed DataSets, when they update the database?

If you are continuing to reuse the DataSet, no. Some of the memory will be
"released", as the changes will have been committed (if coded correctly),
but as long as you are holding onto the reference, not all will be released.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************



Re: Using DataSets... by Cor

Cor
Fri May 09 08:58:26 CDT 2008

William,

Just that I found the denying from Gregory of what you wrote a dataset is a
copy in memory from the database to weak.

It is not. A database is constantly updated by more users. A good one logs
the actions so that it can be restored whatever happens. A dataset is a
reflection from parts of the database at a certain perticulair moment.

A dataset can only be used by one user and the way to persist the data by
serializing is very unsafe because write errors or whatever. (You can
however write changes back to the database and at that perticulair moment
the data is save again).

For the rest nothing to add to Gregory his message.

Cor

"Willian Lopes" <willian@transespecialista.com.br> schreef in bericht
news:24477E8D-CE48-445F-8AEC-1487E0C4D4BE@microsoft.com...
>I know that DataSets are like a "copy" in memory from the database. So,
>there is a logic that I don´t understand: do I have to use a lot of
>DataSets? If yes, when this DataSets will release theyre used memory? If I
>used typed DataSets, when they update the database?
>
> Thanks,
>
> Willian.