Sunday, 2 October 2011

What is the DataAdapter ?



               It is an object that connect one or more Command objects to a DataSet object. They provide logic that would get data from the data store and populates the tables in the DataSet, or pushes the changes in the DataSet back into the data store.
 An OleDbDataAdapter object is used with an OLE-DB provider.
               A SqlDataAdapter object uses Tabular Data Services with MS SQL Server



What are basic methods of DataAdapter

There are three most commonly used methods of DataAdapter :
  Fill : Executes the SelectCommand to fill the DataSet object with data from the data source. It can also be used to update (refresh) an existing table in a DataSet with changes made to the data in the original datasource if there is a primary key in the table in the DataSet.
  FillSchema : Uses the SelectCommand to extract just the schema for a table from the data source, and creates an empty table in the DataSet object with all the corresponding constraints.
  Update: Calls the respective InsertCommand, UpdateCommand, or DeleteCommand for each inserted, updated,or deleted row in the DataSet so as to update the original data source with the changes made to the content of the DataSet. This is a little like the UpdateBatch method provided by the ADO Recordset object, but in the DataSet it can be used to update more than one table.


No comments:

Post a Comment