ADO.NET provides two central Data Access Components. They are
common across all Databases, be it SQL Server or other competitive databases.
Its only the namespace to be used, that differs, while using a Database other
than SQL Server.
DataReader
You can use DataReader to
retrieve a read-only, forward-only stream of data from a database. Results are
returned as the query executes, and are stored in the network buffer on the
client until you request them using the Read method of the DataReader. Using
the DataReader can increase application performance both by retrieving data as
soon as it is available, and ?by default? storing only one row at a time in
memory, reducing system overhead.
DataAdapter
A DataAdapter is used to retrieve data from a data source and
populate tables within a DataSet. The DataAdapter also resolves changes made to
the DataSet back to the data source. The DataAdapter uses the Connection object
of the .NET Framework data provider to connect to a data source, and it uses
Command objects to retrieve data from and resolve changes to the
data source.
Data Reader
|
Data Adapter
|
A
DataReader is an object returned from the ExecuteReader method of a DbCommand
object. It is a forward only cursor over the rows in the each result set.
Using a DataReader, you can access each column of the result set, read all
rows of the set, and advance to the next result set if there are more than
one.
|
A
DataAdapter is an object that contains four DbCommand objects: one each for
SELECT,
INSERT,
DELETE and UPDATE commands. It mediates between these commands and a
DataSet
though the Fill and Update methods.
|
Data Reader is an object used in connected Environment.
|
Data Adapter is an object used in
Disconnected environment using Dataset.
|
Data reader is an object through which you can read a
sequential stream of data. it's a forward only data wherein you cannot go
back to read previous data
|
data set
and data adapter object
help us to
work in disconnected mode. data set is an in cache memory representation of
tables.the data is filled from the data source to the data set thro' the data
adapter. once the table in thedataset is modified, the changes are broadcast
to the database back thro; the data adapter.
|
Each .NET
Framework data provider included with the .NET Framework has a DbDataReader and
a DbDataAdapter object
OLEDB
|
.NET
Framework Data Provider for OLEDB includes an OleDbDataReader and an
OleDbDataAdapter object
|
SQL
Server
|
.NET
Framework Data Provider for SQL Server includes a SqlDataReader and a
SqlDataAdapter object
|
ODBC
|
.NET
Framework Data Provider for ODBC includes an OdbcDataReader and an
OdbcDataAdapter object
|
Oracle
|
.NET
Framework Data Provider for Oracle includes an OracleDataReader and an
OracleDataAdapter object.
|