Search
Winners

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Advertisements
Top Articles Author
Thu, 24-Jul-2014 Authors
All Time Authors
Vishal@Neeraj
28480
Rajkatie
20600
Bharathi Cherukuri
18040

Latest members | More ...


(Statistics delayed by 5 minutes)

Difference between DataSet and DataReader

 Posted by Raja on 4/12/2008 | Category: ASP.NET Interview questions | Views: 48726

Answer:

DataReader
===========
DataReader is like a forward only recordset. It fetches one row at a time so very less network cost compare to DataSet(Fethces all the rows at a time). DataReader is readonly so we can't 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. 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
=======
DataSet is an in memory representation of a collection of Database objects including tables of a relational database schemas.
DataSet is always a bulky object that requires a lot of memory space compare to DataReader. We can say that the DataSet is a small database because 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 the required data like querying database.


Asked In: Many interviews | Alert Moderator 

Found interesting? Add this to:



Comments or Responses

Posted by: Nareyugam on: 4/23/2012 | Points: 10

Datareader is used to read the table records one by one where as dataset in an In Memory object which stores multiple tables

Posted by: Kiran123 on: 5/18/2012 | Points: 10



Login to post response