Update

The Update method updates the current record last read into the instance. This method has the precondition that a record is currently loaded in the instance. On success, the database record is updated.

Update fails if:

If an instance, with a database record loaded, is assigned to a second instance, the second instance is not attached to the database record, and therefore you cannot use the Update method with the second instance. If you attempt to use the Update method with the second instance you can get unpredictable results on different platforms, such as Windows and MCP. To use the Update method with the second instance, you must explicitly re-read the record into the second instance before using the Update method.

Syntax

<<persistent class>>::Update(void) : void

Owner

Any persistent class.

Example

The logic in the following example is incorrect because the instance “AnotherCUST” is not attached to the record that was previously read into the instance “CUST”, and therefore the Update method does not succeed:

Lookup “1” CUST
AnotherCUST := CUST
AnotherCUST.Attr5 := 123
AnotherCUST.Update()

The logic can be corrected by calling the Load() method to explicitly re-read the record into the instance “AnotherCUST”:

Lookup “1” CUST
AnotherCUST := CUST
AnotherCUST.Load()
AnotherCUST.Attr5 := 123
AnotherCUST.Update()