IDataAdapter
This interface represents a data adapter that bridges a data source
and a DataSet
or Data-Table
object. Every ADO.NET provider defines its own provider-specific
class that implements this interface (such as
System.Data.SqlClient.SqlDataAdapter
). Data
adapters play two roles: they transfer data from the data source to
the DataSet
when you invoke Fill( )
, and they apply all DataSet
or
DataTable
changes to a data source when you
invoke Update( )
. In addition, you can use the
FillSchema( )
method before you use the
Fill( )
method to configure schema information
such as column names, data types, and primary key information. The
TableMappings
property accesses the collection of
ITableMapping
objects that map data source tables
to DataTable
objects in the
DataSet
. You can use the
MissingSchemaAction
property to indicate what
action should be taken if you use Fill( )
on a
DataSet
that doesn’t contain the
relevant schema information (by default, the data adapter will add
the required DataColumn
objects with primary key
information). You can also use the
MissingMappingAction
to configure what will happen
if a table is inserted without a matching
ITableMapping
existing in the
TableMappings
collection (by default, the table
name from the data source is used for the DataSet
).
public interface IDataAdapter { // Public Instance Properties public MissingMappingAction MissingMappingAction{set; get; } public MissingSchemaAction MissingSchemaAction{set; get; } public ITableMappingCollection TableMappings{get; } // Public Instance Methods public int Fill(DataSetdataSet
); public DataTable[ ] FillSchema(DataSetdataSet
, SchemaTypeschemaType
); public IDataParameter[ ] GetFillParameters( ); public int Update(DataSetdataSet
); }