DataSet Vs DataReader

Dataset Vs DataReader

DataReader

1. DataReader is like a forward only recordset.
2. It fetches one row at a time so very less network cost compare to DataSet(Fethces all the rows at a  time).
3. DataReader is readonly so we can’t do any transaction on them.
4. DataReader will be the best choice where we need to show the data to the user which requires no transaction. 
5. As DataReader is forward only so we can’t fetch data randomly. .NET Data Providers optimizes the  DataReader to handle huge amount of data.

DataSet
1. DataSet is an in memory representation of a collection of Database objects including tables of a          relational database schemas.
2. DataSet is always a bulky object that requires a lot of memory space compared to DataReader. We can say that the DataSet is a small database because it stores the schema and data in the application memory area.
3. DataSet fetches all data from the datasource at a time to its memory area.
4. We can traverse through the object to get the required data like querying database.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s