Search This Blog

Thursday, December 2, 2010

Difference between DataAdapter and DataReader

1. DataReader directly access the table and it is only used for reading the records from it whereas dataadapter, used to maintain connection, is always used with dataset as dataset is of disconnected-architecture in nature.

2. DateReader is an forward only and read only cursor type if you are accessing data through DataRead it shows the data on the web form/control but you can not perform the paging feature on that record(because it's forward only type). Reader is best fit to show the Data. While  DataAdapter is not only connect with the Databse(through Command object) it provide four types of command (InsertCommand UpdateCommand DeleteCommand SelectCommand) It supports to the disconnected Architecture of .NET show we can populate the records to the DataSet. where as Dataadapter is best fit to work on data.

3. Datareader is connected mode. and read and forward-only Data while  DataAdapter is Bridge between Database and DataSet.

4. Data Reader will read only one record at a time So memory consumption will be less while Data Adapter acts as a mediator between dataset and database server.It will read data from the database server and places with in dataset so Memory consumption is high.

No comments:

Post a Comment