Difference between DataSet and DataReader?

ADO.NET has two major objects for Data Fetching, DataSet and DataReader. What is the Difference between DataSet and DataReader? In which scenario you will prefer DataSet?


Nirmal Sinha
Views: 5337 | Community Opinion: 9

Tags..  ASP.Net Interview  ADO.NET  DataSet  DataReader  .Net Framework

Bookmark this page..



Ask a New Question Go to Home

Community Opinion/Answers
 
Parkash Said..

Comparison of DataSet and DataReader objects (DataSet vs DataReader)

DataSet is a disconnected architecture, while DataReader has live connection while reading data. If we want to cache data and pass to a different tier DataSet forms the best choice and it has decent XML support.

When application needs to access data from more than one table DataSet forms the best choice.

If we need to move back while reading records, datareader does not support this functionality.

One of the biggest drawbacks of DataSet is speed. As DataSet carry considerable overhead because of relations, multiple tables etc speed is slower than DataReader. Always try to use DataReader wherever possible, as it’s meant specially for speed performance.




Virendra I. Yadav Said..

As i am fresher for this question so i do not have any comment




Praveen Said..

This is correct answer in my point view.




kishore Said..

its good but need more information




Amit Said..

Yes




Amit Tiwari From DigiSoft Said..

this is right ans but i think u should provided more information then it




Vivek Jain Said..

i have some more points to include right here:

1- Dataset is heavy weight while DataReader is light weight.
2- Dataset is non persistence while DataReader is persistence.




amit.chandra Said..

Yes, the ans is right.




ebus Said..

good uses full thanks...........






Register or Login to Post Your Opinion