DataAdapter
In ADO.NET, a data adapter is an object that acts as a bridge between a data source and a disconnected in-memory data representation such as a DataSet, enabling data to be retrieved into the DataSet and later written back to the data source.
Overview
The DataAdapter is an abstract base class in the System.Data.Common namespace; provider-specific implementations typically derive from DbDataAdapter. Data adapters are used with the ADO.NET disconnected model, where an application loads data into a memory-resident DataSet and later reconciles changes back to the underlying data source.Operation
Filling a DataSet
A DataAdapter populates a DataSet through its Fill method, using its SelectCommand to retrieve rows from the data source.Updating the data source
A DataAdapter can persist changes made in the DataSet back to the data source using Update; it applies INSERT, UPDATE and DELETE operations as appropriate based on changes tracked in the DataSet, using command objects such as InsertCommand, UpdateCommand and DeleteCommand.Schema and table mappings
Data adapters can also configure a DataSet's schema from the data source and can map source table names to DataTable names through table mappings.Implementations
Provider-specific data adapters include:- SqlDataAdapter for Microsoft SQL Server
- OleDbDataAdapter for OLE DB data sources
- OdbcDataAdapter for ODBC data sources