Difference Between DataSet and DataReader in ADO.NET

Posted By : Bipul Kumar Tiwari,

Dataset and DataReader are very widely used in asp.net applications to fetch the data from the database. DataSet is a collection of in memory tables and dataReader provides the ability to expose the data from database. DataReader will fetch the data very fast when compared with dataset. The major difference between DataSet and DataReader are:


DataReader DataSet
Data Reader works in connected mode and it can hold one table at a time. Data Set works in disconnected mode and it can hold multiple tables at a time.
DataReader is like a forward only recordset. It fetches one row at a time . DataSet which fetches all the rows at a time.
DataReader is designed to retrieve a read-only, forward-only stream of data from data sources. DataSet is an in-memory representation of a collection of Database objects including related tables, constraints, and relationships among the tables. 
DataReader fetches data from a single table. DataSet can fetch data from multiple tables.
DataReader no transaction (insert, update and delete) is possible. DataSet yes transaction (insert, update and delete) is possible.
DataReader can not be serialized. DataSet can be serialized and represented in XML .


DataReader Example:

Data Reader

DataSet Example:

Data Set


 

About the Author

author
Its me BIPUL who is logically minded creative at heart , a good communicator , a self taught full stack developer. I constantly focuses on my thinking , reading , collecting and creating my work in a order to enhance my skills.

I discover new dimensions for growing bussiness with a proven record in creating database and programming. I have a strong technical skills as well as strong interpersonal skills. Read more...
 

Browse By Category

Popular Articles