Ilya
Tue Dec 20 14:43:01 CST 2005
DataSet's do use noticeable amount of memory to store user's data.
As to "much slower than handmade code that iterates and updates from a
DataReader", it's not actually that much.
Our performance tests for SQL Mobile indicate what looping through records
in DataReader, accessing all fields and discarding of data takes about
75-80% of DataAdaper.Fill() time.
Best regards,
Ilya
This posting is provided "AS IS" with no warranties, and confers no rights.
*** Want to find answers instantly? Here's how... ***
1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
"Robert Simpson" <rmsimpson@noemail.noemail> wrote in message
news:ujQu2YZBGHA.4076@TK2MSFTNGP14.phx.gbl...
> SQLite, being an ADO.NET wrapper, behaves pretty much exactly the way
> every other ADO.NET provider behaves. Therefore it would be more precise
> and beneficial to explain ADO.NET behavior rather than SQLite behavior.
>
> A DataReader is what ADO.NET uses to populate a DataSet/DataTable. When
> you use a DataAdapter and call the Fill() method, the DataAdapter is
> actually opening up a DataReader and loading all of the columns and data
> into the destination DataSet/DataTable.
>
> The major differences between a DataReader and a DataSet are:
>
> The DataReader is a stream, whereby you read one row from the stream and
> then move to the next row. There is no concept of moving backwards or
> randomly from one row to another. As someone else stated in the forums, a
> DataReader is a firehose.
>
> A DataSet is an in-memory grid-like structure that holds all the rows and
> all the columns from a DataReader. Once the DataSet is filled up you can
> dispose of the DataReader entirely and work with the contents of the
> DataSet in an offline fashion.
>
> Think of a DataSet as a bucket. You aim the firehose at the bucket and
> the bucket collects all the water. You can then stick your cup in the
> bucket and grab whatever amounts of water you want from anywhere in the
> bucket -- but the firehose has been turned off and put away and all
> you're left with is the isolated bucket.
>
> Any changes made to data in a DataSet are tracked. It becomes possible
> then to use a DataAdapter to actually trigger UPDATE/INSERT/DELETE
> statements that can synchronize the changes you've made back to the
> underlying database.
>
> The DataReader has no such capacity. It is read-only. If you want to
> change data you have to generate your own UPDATE/INSERT/DELETE commands
> and execute them.
>
> As for performance ... all the convenient DataSet features that track
> changes, raise events and store all the data come at a cost. DataSets are
> memory hogs and are much slower than handmade code that iterates and
> updates from a DataReader.
>
> Robert
>
>
>
>
> "Daniel" <danielsanberger@googlemail.com> wrote in message
> news:1135100921.943599.303970@g44g2000cwa.googlegroups.com...
>> Hi Bill,
>>
>> thanks for your help. Ok, more precise, I did setup a DbDataReader on
>> SQLite. My first question is, what is the advantage of a DataSet
>> compared to a DataReader. My second is, if there is a tutorial
>> available using a DataSet (at best with SQLite Wrapper!).
>>
>> Daniel
>>
>
>