Promotic

Update - method of the AdoRecordset object

Description:
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 editing).
Syntax:
Empty Update([Variant aFields], [Variant aValues])
Parameters:
aFields[optional] (Variant) A single name, or an array of column 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.
Note:
The parameters aFields and aValues can be used to give in the Update method all modified values. There are 2 ways to modify the values of the current record:
1) Change the field values by writing into the Value property and then confirming the data by the Update method without parameters.
2) Batch modification of values by the additional parameters aFields and aValues of the Update method.


Caution:
In the edit mode, the AdoRecordset object is locked, so it is impossible to call methods for moving the current record position, etc., until the edit mode is terminated by calling the Update or CancelUpdate 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 an error, the operation can be executed again with correct values or cancel the edit mode by the CancelUpdate method. See Example.
Example1:
JavaScriptVBScriptSelect and copy to clipboard

oRs.Update();
// or
oRs.Update(aFields, aValues);
Example2:

History:
Pm8.01.00: Created
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.