ComponentOne DataObjects for .NET
Changing Data as a Result of Update (Refresh)
DataObjects for .NET (Enterprise Edition) > Updating the Database > Changing Data as a Result of Update (Refresh)

After a successful update, the updated and added rows are retrieved from the database. This is necessary because the database can change the data, for example, set default values, and because the data could be modified by other users, if such concurrency is allowed by the UpdateLocateMode and UpdateLocate properties, see Generated SQL Statements.

Retrieving the current data from the database is called the refresh phase of the update process, see Generated SQL Statements. The retrieved values, if different from the row values sent for update, substitute the row values in the originally sent row, and the client receives them back in the refreshed row.

The process of refreshing rows after update can be customized using the UpdateRefreshMode and UpdateRefresh properties. It can also be customized in the AfterUpdateRow event. Setting values in the Row argument of the event, you can specify the values returned to the client in the refreshed row. The Row values can also be changed in the BeforeUpdateRow event, but then they are also used in updating the database row, whereas setting values in AfterUpdateRow only affects the values returned to the client. In addition to BeforeUpdateRow/AfterUpdateRow events, you can use the AfterUpdate event to programmatically change the refreshed rows. That event is fired once after all rows are updated.

For bound tables (with non-empty Connection and DbTableName properties), the refresh occurs automatically, using a generated SQL statement, see Generated SQL Statements. For an SQL-based table with attached DataAdapter component, the refresh is also done automatically, by the DataAdapter component. For SQL-based without DataAdapter component and for unbound tables, the refresh must be done in code, if necessary, in the AfterUpdateRow event (or in BeforeUpdateRow, see above) by setting the row values in the Row argument. For details, see Bound, SQL-Based and Unbound tables.