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




Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

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