ComponentOne True DataControl 8.0
CancelUpdate Method

 

CancelUpdate Method

Enhanced version of ADO CancelUpdate, includes resetting bound controls.

Syntax

TData.CancelUpdate

Remarks

Method applies to TData control.

Arguments: None

Return Value: None

This method is an improved version of the standard ADO CancelUpdate/CancelBatch methods. These standard methods have a deficiency that the True DataControl CancelUpdate method corrects.

First, it does what the standard ADO method does; it cancels all pending changes. In batch update mode (TData.LockType=adLockBatchOptimistic), it cancels changes made to any rows after the last Recordset.UpdateBatch call. When not in batch update mode, it cancels changes made to the current record after the last Recordset.Update call. (These two cases are actually equal, since non-current rows can have pending changes only in batch update mode).

Next, the True DataControl CancelUpdate method reverts all changes made in bound controls that have not yet been sent to the recordset. This covers an important case, when the end-user has modified the value of a field in a bound control, but that value has not yet been assigned to the field. The most common occurrence of this is when the value is invalid; the field does not accept it. There are no changes made to Recordset yet, so Recordset.CancelUpdate does nothing. On the other hand, the user obviously expects it to replace the invalid value with the current data source value. That's what TData.CancelUpdate does, it refreshes all bound controls with the current data source values, regardless of any other circumstances.

See Also

TData Control

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback