ComponentOne DataObjects for .NET
Events in Updating a Row
DataObjects for .NET (Enterprise Edition) > Updating the Database > Events in Updating a Row

After an IDCommand is set up with the generated SQL statement, DataObjects for .NET fires the C1TableLogic.BeforeUpdateRow event. Using this event, you can customize the command; for example, change the parameter substitution, if necessary. This event is also used to implement updates in SQL-based and unbound tables, see Updating SQL-based and Unbound Tables. In this event procedure, you can set the Status argument specifying how to proceed after the event is handled. The default value, Continue means the command is to be executed. If you want to take full control over update and cancel the default processing (command execution), do whatever is necessary to update the row in your event handler procedure and set the Status argument to SkipCurrentRow. There are also ErrorsOccurred and SkipAllRemainingRows options used to handle update failures. Another event argument, Row contains the C1DataRow being updated. It can be used to extract the current and original values of each field, if you need them to perform a custom update operation. After update, you can modify the field values in this row to customize data refresh after update, see Changing Data as a Result of Update (Refresh).

If not skipped by setting the Status argument of the BeforeUpdateRow event, the update itself takes place, the command containing the INSERT, DELETE or UPDATE SQL statement is executed. After that, except for deleted rows, the SELECT command is executed to refresh the data with the latest database values, see Changing Data as a Result of Update (Refresh).

After executing generated commands, DataObjects for .NET fires the C1TableLogic.AfterUpdateRow event. This event can be used, for example, for customizing data refresh after update, by setting the values in its Row argument.