Search This Blog

Thursday, December 2, 2010

What is the Difference between Dataset and Datareader?

1. Datareader is forward and read only recordset in which the data manipultions are cant carried. but dataset is the miniature of database in which the datas can be accessed randomly and data manipulations can be carried.

2. Datareader is like a forward only recordset. It fetches one row at a time so very less Network Cost compare to DataSet (Fetches all the rows at a time). DataReader is readonly so we cannot do any transaction on them. DataReader will be the best choice where we need to show the data to the user which requires no transaction ie reports. Due to DataReader is forward only we cannot fetch the data randomly. .NET Dataproviders optimizes the datareaders to handle the huge amount of data.
DataSet is always a bulky object that requires lot of memory space compare to DataReader. We can say the dataset as a small database coz it stores the schema and data in the application memory area. DataSet fetches all data from the datasource at a time to its memory area. So we can
traverse through the object to get required data like qureying database.

3.Data Reader can't persist the data while Data Set can persist the data

4. Using Data Reader only one value can be accessed from the database whereas using Dataset you can access a any number of values from the database.

No comments:

Post a Comment