Question:

DataSet vs DataReader

by Guest9571  |  12 years, 9 month(s) ago

0 LIKES UnLike

DataSet vs DataReader

 Tags: datareader, DataSet, vs

   Report

3 ANSWERS

  1. Guest1387
    ::DataReader::

    A DataReader is specific to a data provider (for example, SqlDataReader, OdbcDataReader, and OleDbDataReader).

    The data retrieved through a DataReader is read-only.
    The data retrieved through a DataReader is forward-only. Once the data has been cycled through, the DataReader must be closed and re-created in order to reaccess the data.

    A DataReader presents data through a direct connection to the data source. Only one row of data is stored in Internet Information Services (IIS) memory at any one time.

    A DataReader is fast.

    A DataReader takes up few IIS and memory resources but annexes the databaseconnection until it’s closed.

    A DataReader lasts as long as the connection to the database is open. It can’t be persisted in a cookie or a session variable.

    Fields in a DataReader are referenced by index number or name.

    A DataReader has no concept of primary keys, constraints, views, or any other relational database management system (RDBMS) concept except row and field.

    You can’t update a data source through a DataReader.

    A DataReader connects to only onedata source.
    ------------------------------------------------------------------------------------------------------

    ::DataSet::

    The DataSet class isn’t a part of any data provider. It’s specific to .NET only. However, the DataAdapter used to fill the DataSet with Fill() is specific to a data provider.

    The data retrieved through a DataSet is read-write.

    You can work with data in a DataSet in any order you choose as many times as you like.

    A DataSet stores all the data from the data source in IIS memory at once.

    A DataSet is slower than a DataReader.

    A DataSet takes up a lot more memory/IIS resources to store all the data, but it doesn’t hold up a database connection until it’s closed. The connection needs to be open only when Fill() is called.

    A DataSet lasts only until the page is reloaded (posted back) unless it’s somehow persisted (for example, in a session variable).

    You can reference fields in a DataSet by name, but you must also name the

    DataTable and identify the row (index) that contains the field.

    A DataSet contains DataTables. A primary key may be set for each DataTable, and relationships and constraints may be established between them. DataViews may be created over the DataSet.

    You can make changes to data in a DataSet and then upload those changes back to the data source.

    A DataSet can be filled with Fill() from multiple data sources.

  2. Leonardo
    "You can’t update a data source through a DataReader."

    Tayyab, what if i use an update query and run it against a DataReader, what do you reckon, would it work?
  3. Guest4607
    Thanks for your concern Awais.

    It works. The "database" is updated But the "datasource" still not updated. I here stated that datasource can not be updated through datareader. Yes if you take database as datasource instead of datareader then its true. Hope this is answer of your question.
Sign In or Sign Up now to answser this question!
You're reading: DataSet vs DataReader

Question Stats

Latest activity: 15 years, 3 month(s) ago.
This question has 3 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions