alert('Oh shit !!!! Javascript is disabled!!!! ');


Blog Archive

The use of data adapter.?

The use of data adapter.?

data adapter:-The DataAdapter serve as a bridge between a DataSet and data source for retrieving and saving data. The DataAdapter provides this bridge by using Fill to load data from the data source into the DataSet and using Update to send changes made in the DataSet back to the data source.  The data adapter objects connect a command objects to a Dataset object. They provide the means for the exchange of data between the data store and the tables in the DataSet.An OleDbDataAdapter object is used with an OLE-DB provider
A SqlDataAdapter object uses Tabular Data Services with MS SQL Server.

Namespace:  System.Data.Common
Assembly:  System.Data (in System.Data.dll)

Data adapter Flow  Architecture

The DataAdapter acts as a bridge between the disconnected DataSet and the data source. It exposes two interfaces; the first of these,IDataAdapter that  defines methods for populating a DataSet with data from the data source and for updating the data source with changes made to the DataSet on the client. The another interface is  IDbDataAdapter that  defines four properties, each of type IDbCommand. These all properties each set or return a command object specifying the command to be executed when the data source is to be queried or updated:

 

Constructors of Data Adapter?

There are two constructor:

Name Description
DataAdapter(DataAdapter) Initializes a new instance of a DataAdapter class from an existing object of the same type.
DataAdapter Initializes a new instance of a DataAdapter class.

Property  of Data Adapter?

there are following main property:

                                              Name           Description
TableMappings Gets a collection that provides the master mapping between a source table and a DataTable.
Container Gets the IContainer that contains the Component. (Inherited from Component.)
DesignMode Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.)
Events Gets the list of event handlers that are attached to this Component. (Inherited from Component.)

AcceptChangesDuringUpdate

Gets or sets whether AcceptChanges is called during a Update.
 

AcceptChangesDuringFill

Gets or sets a value indicating whether AcceptChanges is called on a DataRow after it is added to the DataTable during any of the Fill operations.

Method  of Data Adapter?

there are following main method:-

                                                               Name                                                     Description
Dispose                                      Releases all resources used by the Component (Inherited fromComponent.)                                     
Fill(DataSet) Adds or refreshes rows in the DataSet to match those in the data source.
Finalize Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.)
GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
GetType Gets the Type of the current instance. (Inherited from Object.)

Event of Data Adapter?

There are two events:-

Name Description
Disposed Occurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)
FillError Returned when an error occurs during a fill operation.
 

Interface Implementation of Data Adapter?

Name Description
IDataAdapter.TableMappings Indicates how a source table is mapped to a dataset table.

Basic method of Data Adapter?

There are three basic method in data adopter:-

(i)Fill:-Fill  method executes the SelectCommand to fill the DataSet object with data from the data source,Depending on whether there is a primary key in the DataSet, the ‘fill’ can also be used to update an existing table in a DataSet with changes made to the data in the original datasource.

(ii)FillSchema:-Fill Schema method executes the SelectCommand to extract the schema of a table from the data source and  creates an empty table in the DataSet object with all the corresponding constraints.

(iii0Update:-Update method executes the InsertCommand, UpdateCommand, or DeleteCommand to update the original data source with the changes made to the content of the DataSet.

(iv) Dispose :- releases all the resources