Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Thread Tools Search this Thread
Old 16-01-2009
Join Date: Dec 2008
Posts: 12
Dataset vs DataReader in .Net

Hi all,

My project is a windows application in VB.Net with SQL database.
But i dont have much knowledge about the Dataset and Datareader for database connectivity.

Can any one please give me some information about the Dataset and datareader in .Net.

Thanks in Advance.
Reply With Quote
Old 16-01-2009
Join Date: Apr 2008
Posts: 2,001
Re: Dataset vs DataReader in .Net

The ADO.NET DataReader is used to retrieve "read-only" / "forward-only" data from a database. Using the DataReader increases application performance and reduces system overheads. This is due to one row at a time is stored in memory. You create a DataReader by calling Command.ExecuteReader after creating an instance of the Command object.

The following line of code is used to retrieve rows from a data source.

SqlDataReader myReader = myCommand.ExecuteReader();
The DataSet is a in-memory representation of data that provides a consistent relational programming model regardless of the data source. It can be used with multiple data sources. The DataSet represents a complete set of data including related tables, constraints, and relationships among the tables. The methods and objects in a DataSet are consistent with those in the relational database model. The DataSet can also persist and reload its contents as XML and its schema as XML Schema definition language (XSD) schema.

The DataAdapter acts as a bridge between a DataSet and a data source for retrieving and saving data. The DataAdapter provides this bridge by "mapping Fill". Which changes the data in the DataSet to match the data in the data source. Upon this an Update occurs, which changes the data in the data source to match the data in the DataSet.
Reply With Quote
Old 16-01-2009
Join Date: Oct 2005
Posts: 2,389
Re: Dataset vs DataReader in .Net

Following are some Points to be consider while choosing between the DataSet and DataReader objects.
  • DataSet Object has Read/Write access, While DataReader Object has Read-only access

  • DataSet Object Supports multiple tables from different databases, While DataReader Object Supports a single table based on a single SQL query of one database

  • DataSet Object works under Disconnected mode, While DataReader Object has Connected mode

  • DataSet Object is Bind to multiple controls, While DataReader Object is Bind to a single control

  • DataSet Object supports Forward and backward scanning of data, While DataReader Object supports Forward-only scanning of data

  • DataSet Object has Slower access to data, While DataReader Object has Faster access to data

  • DataSet Object has Greater overhead to enable additional features, While DataReader Object being Lightweight object with very little overhead

  • DataSet Object is Supported by Visual Studio .NET tools, While DataReader Object Must be manually coded
Reply With Quote
Old 07-05-2011
Join Date: May 2011
Posts: 1
Re: Dataset vs DataReader in .Net

Nature of Connection:
Dataset: is generally used to employ disconnected architecture of Ado.Net
DataReader: is directly connected to database system.

Local Storage:
Dataset: It reads data from database and stores in local system.
DataReader: No Local storage is required.

Where to use:
Dataset: If you are going more number of operations(updates, inserts and deletes) on database and updates done in batch wise, then dataset will be best option. Use Dataset, if you are going to implement sites, which are no need of changes on every client clicks, such as "Carting in shoping mall sites", "display information in websites from database".
DataReader: If you are going to fewer operations and directly implementation of queires on database, the datareader is best option. Use DataReader, if you are going to implement "Booking a berth in Railways", "display current price in Stock Market".

Performance: Choose Dataset or DataReader according to situation, purpose and uses of database display.
Reply With Quote

  TechArena Community > Software > Software Development
Tags: , ,

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads for: "Dataset vs DataReader in .Net"
Thread Thread Starter Forum Replies Last Post
How to use datareader in VB.Net Jateen Software Development 5 13-03-2011 11:17 PM
How to create a new DataSet Leonard Windows Software 5 23-03-2010 08:52 AM
How to use dataset in ASP.Net? Roxy_jacob Software Development 3 28-11-2009 06:13 PM
Working with XML and DataSet Aanand Software Development 3 01-05-2009 02:38 PM
VB.NET Datareader to display number of rows? Pooja Software Development 3 14-02-2009 06:29 PM

All times are GMT +5.5. The time now is 01:50 AM.