asp.net.ph

DbDataAdapter.Update Method

System.Data.Common Namespace   DbDataAdapter Class


Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the DataSet.

Overload List

1. Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the specified array of DataRow objects.

2. Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the specified DataSet.

3. Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the specified DataTable.

4. Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the specified array of DataRow objects.

5. Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the DataSet with the specified DataTable name.


Example

NOTE:This example uses one of the overloaded versions of Update. For other examples that may be available, see the individual overload topics.

public DataSet UpdateDemo ( DataSet myDataSet, string connString, 
      string strQuery, string myTableName ) {

   OleDbConnection myConn = new OleDbConnection ( connString );
   OleDbDataAdapter myAdapter = new OleDbDataAdapter ( );
   myAdapter.SelectCommand = new OleDbCommand ( strQuery, myConn );
   OleDbCommandBuilder custCB = new OleDbCommandBuilder ( myAdapter );

   myConn.Open ( );
   DataSet myDataSet = new DataSet ( );
   myAdapter.Fill ( myDataSet );

   // ... code to modify data in DataSet here ...

   // without the OleDbCommandBuilder this line would fail
   myAdapter.Update ( myDataSet,"Categories" );

   myConn.Close ( );
   return myDataSet;
}
  C# VB

See Also

DbDataAdapter Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph