ComponentOne DataObjects for .NET
Handling Update Errors on the Client
DataObjects for .NET (Enterprise Edition) > Updating the Database > Handling Update Errors on the Client

When an error condition of any kind occurs on the server during an update, the UpdateError event fires. If the error is a fatal failure, the Error argument of the UpdateError event contains the exception object describing the failure. For more information on a program or physical error, see Handling Errors in Update. If this is a concurrency conflict that could not be reconciled on the server and so was passed to the client, the Error argument is set to null (Nothing in Visual Basic). In case of a concurrency conflict, the rows that failed update can be found in the C1DataSet using the properties and methods RowError, HasErrors, HasErrors and GetErrors.

When writing code in the UpdateError event, developers can handle errors and reconcile concurrency conflicts. If you consider the error conditions resolved and want to make a new attempt to update the database, set the Status argument to Continue. That will repeat the Update method call. If there will still be errors, the UpdateError event will fire again, and this loop will continue until the update succeeds or until you exit the UpdateError event with Status = Skip or Status = ErrorOccurred. If Status is set to Skip, the update loop ends without exception, in effect, the Update call is ignored. If Status is set to ErrorsOccurred, an exception is thrown.

In the case of a fatal error (non-empty Error argument), the usual reaction is to set Status to ErrorOccured (throw an exception), or to Skip (ignore the Update call).

In the case of a concurrency conflict (empty Error argument), the recommended practice is to present the user with a special dialog(s) offering to reconcile the conflicts, for example, to choose between the values in the data set and the values in the database (to retrieve the current database values, use a separate C1DataSet object with the same schema). After reconciling the conflicts, repeat the update attempt by setting the Status argument to Continue. Alternatively, you can set Status to Skip before reconciling conflicts, and then repeat Update programmatically.