5.7. How Update Works

Calling the DbDataAdapter.Update method triggers a series of steps to update the database with changes made to the object specified (DataTable, on a per-row basis). The sequence of events is as follows:

1.
The values in the DataRow are moved to the parameter values.
2.
The OnRowUpdating event is raised.
3.
The command executes.
4.
If the command is set to FirstReturnedRecord, then the first returned result is placed in the DataRow.
5.
If there are output parameters, they are placed in the DataRow.
6.
The OnRowUpdated event is raised.
7.
AcceptChanges is called.

5.7.1. Controlling Updates

The DataAdapter.Update method, when applied to a DataSet, applies inserts, updates, and deletes in a predefined order. Sometimes, ...

Get Essential ADO.NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.