Update - method of the AdoRecordset object
It is used for ending the edit mode and confirmation
of all modifications of the current record.
The record edit mode has been called by the AddNew
method or by simple writing into the current record (record edit).
Empty Update([Variant aFields], [Variant aValues])
|aFields||[optional] (Variant) A single name, or an array of names or ordinal positions of the fields in the record.|
|aValues||[optional] (Variant) A single value, or an array of values for the fields in the new record.
If aFields is an array, then aValues must also be an array with the same number of members, otherwise an error occurs.
The order of field names must match the order of field values in each array.
The parameters aFields
can be used to give in the Update
method all modified values. There are 2 ways to modify the values of the current record:
Modify the field values by writing into the Value
property and then confirming the data by the Update
method without any parameters.
Batch modification of values by the additional parameters aFields
of the Update
In the edit mode, the AdoRecordset
object is locked, so it is impossible to call methods for moving the position of current record, etc., until the edit mode is terminated by calling the Update
methods. The Update
method returns no value, but it can possibly fail (e.g. when trying to write a record with key value that allready exists or with invalid values). If the Update
method fails, the AdoRecordset
object stays locked and cannot be used in a normal way. Therefore it is necessary to test the result of the Update
method by means of the Pm_LastErr
property of the Wrapper object
object (that wrapps each AdoRecordset
object automatically in the PROMOTIC system). In case of error the operation can be executed again with correct values or cancel the edit mode by the CancelUpdate
method. See Example