Shivprasad Koirala
.NET Interview Question - How does “Dataset” differ from a “Data Reader”?
By Shivprasad Koirala in ASP.NET on Feb 20 2011
  • Shivprasad
    Feb, 2011 27

    Thanks Sarika and Mukesh for your value add.

    See my 50 .NET interview questions and answers

    • 0
  • sarika jain
    Feb, 2011 22

    Differences are:

    1.Dataset is a memory based relational representation of data or it can be said that it is a cached set of records that are retrieved from the database whereas DataReader is a read and forward only mode to retrieve data from any data source.

    2.Dataset can persist the data permanently in the data source if you do any change whereas DataReader can't persist the data.

    3.Dataset is a part of disconnected environment where any change done is only visible after refreshing the page whereas DataReader is a part of connected environment and can find the changes in the database reflected in data reader immediately.

    4.Dataset can access any number of values at a time but DataReader can access only one row or value from the database at a time.

    5.Dataset is slow as compare to datareader as it retrieves the block of data whereas DataReader is fast as it only deals with retrieving the data from the datasource.

    6.Dataset can do all the DML operations whereas DataReader can retrieve the data through select statement but can;t perform the DML statement.

    • 0
  • Mukesh Kumar
    Feb, 2011 21

    Data reader 
    1. It is a read only .
    2. Can't contain more than one table
    3. Data manipulation is not possible.
    4. It is comes under connected architecture.
    5. One of the most advantage is it is much faster than dataset

    Data set:

    1. It can works in connected as well as disconnected mode.
    2. Can contain more than one table.
    3. Data Manipulation is possible.
    4. It comes under  disconnected architecture.

    • 0
  • Shivprasad Koirala
    Feb, 2011 20

    • “Dataset” is a disconnected architecture, while “Data Reader” 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, “data reader” does not support this functionality.

    • However, one of the biggest drawbacks of Dataset is speed. As “Dataset” carry considerable overhead because of relations, multiple table’s etc speed is slower than “Data Reader”. Use “Data Reader” when you want to quickly read and display records on a screen.


    Click here for more 22 top .NET Interview Questions

     

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS