Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Asp.net difference between DataReader, DataTable and DataSet
01-03-2011, 11:10 AM
Post: #1
Not Solved difference between DataReader, DataTable and DataSet
what is the difference between DataReader, DataTable and DataSet??

Best Regards
01-03-2011, 11:27 AM
Post: #2
Not Solved RE: difference between DataReader, DataTable and DataSet
1. Its an connection oriented, whenever you want fetch the data from database that you need the connection. after fetch the data connection is diconnected.
2. Its an Read only format, you cann't update records.

1. Its connectionless. whenever you want fetch data from database. its connects indirectly to the database and create a virtual database in local system. then disconnected from database.
2. Its easily read and write data from virtual database.

A DataTable object represents a single table in the database. It has a name rows and columns.
There is not much difference between dataset and datatable, dataset is just the collection of datatables.

[Image: 2604595733.png]
06-07-2012, 08:48 AM
Post: #3
Not Solved RE: difference between DataReader, DataTable and DataSet
DataReader is a forward-only iterate over a set of results. it,s connection oriented and only loads one record at a time.
A dataset is an in-memory representation of a database-like structure. It can have one or more datatables and define relations between them, key or any fields etc.
A datatable is an in-memory representation of a single db table. You can think of it as having columns and rows in the same way.
07-23-2012, 04:41 AM
Post: #4
Not Solved RE: difference between DataReader, DataTable and DataSet
I have used Datatable and Dataset interchangeably. A Dataset has an overhead perfomance hit when its loaded with a lot of Data. Now let me be more clearer, a Dataset can Contain a lot of Datatable :- A Dataset is like a Container for Datatables because every dataset has a datatable contained inside it and a Datatable is like a table you have in SQL and a Dataset its like a Database that contain table(Datatable).

DataSet and DataTable are the key components in ADO.NET programming. This mean that DataTable represents an in memory representation of the database. We can load a single Table from the database into a DataTable and manipulate the data in memory. DataTable can be used as a DataSource and used it if we are going to fetch data in a single database table only. While DataSet on the other hand can define DataRelations - which define the relationship between DataTables, much like a foreign key relationship can be set up between tables in a database. DataSets, themselves DOES NOT Contain any Data. DataSets contain DataTables (which is where any data actually resides),DataRelations, etc, but no data.
08-16-2012, 12:52 PM
Post: #5
Not Solved RE: difference between DataReader, DataTable and DataSet

Provides a means of reading a forward-only stream of rows from a SQL Server database. This class cannot be inherited.
The SqlDataReader can only retrieve one row at a time from the data source and in order for it to get the next record,
it has to maintain its connection to the data source. A DataReader is a stream of data that is returned from a database query. When the query is executed, the first row is returned to the DataReader via the stream.
The stream then remains connected to the database, poised to retrieve the next record.


The DataTable is a central object in the ADO.NET library. Other objects that use the DataTable include the DataSet and the DataView.
The DataTable also contains a collection of Constraint objects that can be used to ensure the integrity of the data.


The DataSet, which is an in-memory cache of data retrieved from a data source, is a major component of the ADO.NET architecture. The DataSet consists of a collection of DataTable objects that you can relate to each other with DataRelation objects.
You can also enforce data integrity in the DataSet by using the UniqueConstraint and ForeignKeyConstraint objects.
11-08-2012, 06:43 AM
Post: #6
Not Solved RE: difference between DataReader, DataTable and DataSet
Thanks, it helped a lot...

View Asad Ali's profile on LinkedIn


Possibly Related Threads...
Thread: Author Replies Views: Last Post
  Relationship DataTable and DataReader ? dongtrien 2 1,049 09-30-2014 07:22 AM
Last Post: dongtrien
  in dataset data is in byte praveen 3 1,220 01-02-2013 10:56 AM
Last Post: nisar87
  How to bind dataset to gridview Dharmesh Sharma 2 3,079 07-23-2012 05:07 AM
Last Post: raj2sekar1
  how to bind dataset to ddl? prasuna 4 2,962 07-23-2012 04:58 AM
Last Post: raj2sekar1
  How to use dataset in silverlight gopal_nivas 1 3,025 03-21-2012 07:20 AM
Last Post: nisar87

User(s) browsing this thread: 1 Guest(s)