Differences between Dataset and DataReader
Dataset vs DataReader
The Dataset object is central to supporting disconnected and distributed data scenarios with ADO.NET. The Dataset is a memory-resident representation of data that provides a consistent relational programming model regardless of the data source. It can be used with multiple and differing data sources, used with XML data, or used to manage data local to the application.
The Dataset represents a complete set of data including related tables, constraints, and relationships among the tables. I think this is something that gives the advantage upon the older ADO.
ADO.NET DataReader to retrieve a read-only, forward-only stream of data from a database. Using the DataReader can increase application performance and reduce system overhead because only one row at a time is ever in memory.
Choosing a DataReader or a Dataset:
When deciding whether your application should use a DataReader (see Retrieving Data Using the DataReader) or a Dataset (see Creating and Using Dataset s), you should consider the type of functionality that your application requires.
Use a Dataset to do the following:
Remote data between tiers or from an XML Web service. Interact with data dynamically such as binding to a Windows Forms control or combining and relating data from multiple sources. Cache data locally in your application. Provide a hierarchical XML view of relational data and use tools like an XSL Transformation or an XML Path Language (XPath) Query on your data. For more information, see XML and the Dataset . Perform extensive processing on data without requiring an open connection to the data source, which frees the connection to be used by other clients.
If you do not require the functionality provided by the Dataset . You can improve the performance of your application by using the DataReader to return your data in a forward-only read-only fashion. Although the DataAdapter uses the DataReader to fill the contents of a Dataset (see Populating a Dataset from a DataAdapter), by using the DataReader you can receive performance gains because you will save memory that would be consumed by the Dataset , as well as saving the processing required to create and fill the contents of the Dataset .
|
| Author: saravanan 14 May 2008 | Member Level: Silver Points : 2 |
dataset-inmemory database datareader-read the value in database
|
| Author: venkat kamal 14 May 2008 | Member Level: Gold Points : 2 |
its ok...but give someother useful information which a lot of members dont know..........
|
| Author: Mahesh Raj 07 Jun 2008 | Member Level: Gold Points : 1 |
This is very good information,Continue posting such useful articles.
|
| Author: Arun Kumar 09 Jun 2008 | Member Level: Bronze Points : 1 |
DataSet is slow as compared DataReader because it can hold data that make's it bulky and then performing a operation on dataset will take time.
|
| Author: http://venkattechnicalblog.blogspot.com/ 09 Jun 2008 | Member Level: Diamond Points : 2 |
Its wrong perception..
Dataset is very much faster when compared to datareader.
Because, you will be having a disconnected environment.
Regards, Venkatesan Prabu . J
|
| Author: navaneethkn 13 Jun 2008 | Member Level: Silver Points : 2 |
Venkatesan Prabu Jayakantham,
Your comment is wrong. DataReader is faster than DataSet. Do you know how a DataSet is filled ? It uses DataReader internally. DataReader is fast forward only reader.
|
| Author: navaneethkn 13 Jun 2008 | Member Level: Silver Points : 2 |
I personally disagree with using DataSet. I prefer to use strongly typed classes some thing like DTO to pass value between tiers. If it is on the network, use a serializable strongly typed objects. It makes your life more easier.
|