ADO 2.5 API Reference

CancelUpdate Method

Cancels any changes made to the current or new row of a Recordset object, or the Fields collection of a Record object, before calling the Update method.

Syntax

recordset.CancelUpdate
record.Fields.CancelUpdate

Remarks

Recordset

Use the CancelUpdate method to cancel any changes made to the current row or to discard a newly added row. You cannot cancel changes to the current row or a new row after you call the Update method, unless the changes are either part of a transaction that you can roll back with the RollbackTrans method, or part of a batch update. In the case of a batch update, you can cancel the Update with the CancelUpdate or CancelBatch method.

If you are adding a new row when you call the CancelUpdate method, the current row becomes the row that was current before the AddNew call.

If you are in edit mode and want to move off the current record (for example, with Move, NextRecordset, or Close), you can use CancelUpdate to cancel any pending changes. You may need to do this if the update cannot successfully be posted to the data source (for example, an attempted delete that fails due to referential integrity violations will leave the Recordset in edit mode after a call to Delete).

Record

The CancelUpdate method cancels any pending insertions or deletions of Field objects, and cancels pending updates of existing fields and restores them to their original values. The Status property of all fields in the Fields collection is set to adFieldOK.

See Also

Visual Basic Example | Visual C++ Example | Visual J++ Example

AddNew Method | Cancel Method | Cancel Method (RDS) | CancelBatch Method | CancelUpdate Method (RDS) | EditMode Property | Update Method

Applies To: Fields Collection | Recordset Object

© 1998-2003 Microsoft Corporation. All rights reserved.