Differences between DataReader and DataSet

Differences between DataReader and DataSet

———————————

DataSet

———-

1. DataSet stores data at run-time[in-memory storage].

So the same data can be used by multiple server controls.

2. DataSet works in connected as well as dis-connected mode.

3. Data Manipulation at run-time is POSSIBLE.

4. DataSet can work with any type of Data Source.

XML, Databases etc

Reading as well as writing data from / to any

data source is possible.

DataReader / SqlDataReader

———————————–

1. DataReader has NO in-memory storage.

It reads data row-by-row.

2. DataReader works in connected mode ONLY.

3. Data Manipulation is NOT possible through

DataReader.

4. DataReader is READ-ONLY / Forward only.

And it reads data from Command object ONLY.

System.Data Namespace

——————————-

DataSet, DataTable and DataView stores tabular data

at run-time. In-memory storage.

DataSet and DataTable can read/write data from/into

any type of data-source.

They works in connected as well as disconnected mode.

– In connected mode, external data is assigned to DataSet or DataTable

– In Dis-Connected mode, Data Manipulation as well as

sending the data to web-pages are done.

DataView is created either from a DataSet or DataTable.

DataSet

———-

•DataSet

– DataTablesCollection

– DataRowsCollection

– DataColumnsCollection

• DataSet stores data in string / XML format

• In DataSet, original sequence of data is maintained.

So, sorting of data is NOT allowed.

DataTable

————–

• DataTable

– DataRowsCollection

– DataColumnsCollection

• Column-wise Data-Type can be assigned in a DataTable

• In DataTable, original sequence of data is maintained.

So, sorting of data is NOT allowed.

DataView

————-

• DataView

– DataRowsCollection

– DataColumnsCollection

• Only string data are stored in a DataView.

• In DataView, Column-wise Sorting of data is allowed.

And Searching in a Sorted column is possible.

DataReader

==============

• No In-memory storage.

DataReader reads data row-by-row.

• DataReader is Read-Only.

And a DataReader object can read data

from Command object only.

• DataReader works in connected mode only.

* Differences between DataReader and DataSet

About

Hi, This is R K Gupta, an IT professional and Entrepreneur. I have written many articles yet for my websites gsesoftsolutions.com, Hope you like it. Kindly subscribe our feed for any updates. Add me in Facebook and Google+

Posted in Microsoft .Net Help, Software Development

Leave a Reply

Your email address will not be published. Required fields are marked *

*