Canceling Pending Cached Updates
Go Up to Using Cached Updates
Pending cached updates are updated records that are posted to the cache but not yet applied to the database. There are three ways to cancel pending cached updates:
- To cancel all pending updates and disable further cached updates, set the
- To discard all pending updates without disabling further cached updates, call the
- To cancel updates made to the current record call
The following sections discuss these options in more detail.
Cancelling Pending Updates and Disabling Further Cached Updates
To cancel further caching of updates and delete all pending cached updates without applying them, set the
CachedUpdates property to
CachedUpdates is set to
CancelUpdates method is automatically invoked.
From the update cache, deleted records are undeleted, modified records revert to original values, and newly inserted record simply disappear.
Discarding Pending Cached Updates
CancelUpdates clears the cache of all pending updates, and restores the dataset to the state it was in when the table was opened, cached updates were last enabled, or updates were last successfully applied. For example, the following statement cancels updates for the
From the update cache, deleted records are undeleted, modified records revert to original values, and newly inserted records simply disappear.
Canceling Updates to the Current Record
RevertRecord restores the current record in the dataset to the state it was in when the table was opened, cached updates were last enabled, or updates were last successfully applied. It is most frequently used in an
OnUpdateError event handler to correct error situations. For example,
Undoing cached changes to one record does not affect any other records. If only one record is in the cache of updates and the change is undone using
UpdatesPending property for the dataset component is automatically changed from
If the record is not modified, this call has no effect. For more information about creating an
OnUpdateError handler, see Creating an OnUpdateRecord Event Handler.