Click here to Skip to main content
16,017,881 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Why DataReader is Faster than DataSet?
Posted

Data Reader is a forward only and read only data
DataSet is used to maintain relationships between multiple
tables.

Data Reader can't persist the data
Data Set can persist the data

datareader(connection oriented) is a read only and forward
only record set which will have the data retrieved based on
the select statement.we can't do DML operations through
datareader.

whereas dataset(disconnected) model which we can do all the
DML operations.
 
Share this answer
 
Performance and scalability are among the many things to consider when choosing data access techniques. As these comparisons have shown, throughput can often be multiplied by choosing one data access technique over another, yet no single approach performs better in all scenarios. Because overall performance is affected by so many factors, there is no substitute for performance testing using realistic scenarios.
http://msdn.microsoft.com/en-us/library/ms978388.aspx[^]
 
Share this answer
 
What is a DataReader?

A DataReader is a read-only stream of data returned from the database as the query executes. It only contains one row of data in memory at a time and is restricted to navigating forward only in the results one record at a time. The DataReader does support access to multiple result sets, but only one at a time and in the order retrieved. Just as in the original version of ADO, the data is no longer available through the DataReader once the connection to the data source is closed, which means a DataReader requires a connection to the database throughout its usage. Output parameters or return values are only available through the DataReader once the connection is closed.


What is a DataSet?

DataSet is the core of the ADO.NET disconnected architecture and is used to store data in a disconnected state. It was designed to fully support the use of XML so an XML document can be read into a DataSet or a DataSet can be exported to XML. This allows a DataSet to be easily transported across a network so it can be used as a return from a Web service or other type of remote call. Changes to a DataSet can be propagated back to the data source from where the data originated. A DataSet is fully navigable forward or backward and the contents can be filtered, sorted, or searched as desired, making all records accessible at any given point.
 
Share this answer
 
v2
Because DataReader work in connected mode while DataSet works in disconnected mode.
A lot of results on google to read deatils
Data Set VSDataReader
 
Share this answer
 
in fact, DataReader and DataSet are not competitors - they are complementary! You grab the data using DataReader and put it in a DataSet!
 
Share this answer
 
Data Reader is a forward only and read only data
DataSet is used to maintain relationships between multiple
tables.

Data Reader can't persist the data
Data Set can persist the data

datareader(connection oriented) is a read only and forward
only record set which will have the data retrieved based on
the select statement.we can't do DML operations through
datareader.

whereas dataset(disconnected) model which we can do all the
DML operations.
 
Share this answer
 
Comments
Ramakrishna, Eswarraju 19-Sep-11 7:55am    
Why we cannot do DML operation on datareader?
We can perform DML operations using ExecuteNonQuery Method().

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900