Calls the respective insert, update, or delete commands on the connection, for each inserted, updated, or deleted rows in the data set for a given source table.
[Visual Basic] Overloads Overridable Public Function Update( _ ByVal dataRows() As DataRow _ ) As Integer [C#] public virtual int Update( DataRow[] dataRows ); [C++] public: virtual int Update( DataRow* dataRows[] ); [JScript] public function Update( dataRows : DataRow[] ) : int;
Exception Type | Condition |
---|---|
UpdateRequiresDataSet | The DataSet is invalid. |
UpdateRequiresSourceTable | The source table is invalid. |
UpdateNullRows | No DataRow exists to update. |
UpdateNullRowTable | No DataTable exists to update. |
UpdateNullRowTableDataSet | No DataSet exists to use as a source. |
All the elements in the array of DataRow objects must come from the same DataTable.
This method pulls rows from the table listed in the first mapping before running an update. The adapter will clone the insert, update, or delete command appropriate for the row. Then the OnRowUpdating event is raised, allowing the user to inspect the DataSet row, modify the cloned DBCommand, or cancel the default processing. The cloned command is then executed against the data source. If the cloned command is configured incorrectly, an error will be raised. The adapter then will refresh the row according to UpdateRowSource property of the DBCommand. Any additional rows returned will be ignored. After any data is loaded back into the DataSet, the OnRowUpdated event is raised, allowing the user to inspect the reconciled DataSet row and any output parameters returned by the DBCommand. When the OnRowUpdated event returns, the adapter releases the cloned copy of the command and any changes made to it between the events are lost. After a row updates successfully, the changes to that row will have been accepted. If the connection was closed prior to Update, the adapter will close the DBConnection.
Notes to Inheritors: When overriding Update in a derived class, be sure to call the base class's Update method.
DBDataSetCommand Class | DBDataSetCommand Members | System.Data.Internal Namespace | DBDataSetCommand.Update Overload List