Top
PowerCOBOL V11.0 Reference
FUJITSU Software

5.103 Examples of the UpdateRecord Method

Example 1:

For a data field that is bound to the custom control "Custom1":
INVOKE Custom1 "UpdateRecord"

Example 2:

For a field that is bound to the Text property of the custom control "Custom2"
INVOKE "Item"("Text") OF "DataBindings" 
                      OF Custom2 "UpdateRecord"

Example 3:

For data fields that are bound to several properties of the custom control "Custom3"
WORKING-STORAGE SECTION.
01 PROPERTY-COUNT PIC S9(9) COMP-5.
01 IDX  PIC S9(9) COMP-5.
PROCEDURE DIVISION.
	MOVE "Count" OF Custom3 TO PROPERTY-COUNT
	PERFORM VARYING IDX FROM 1 BY 1 UNTIL I > PROPERTY-COUNT
	    INVOKE "Item"(IDX) OF "DataBindings" 
	                       OF Custom3 "UpdateRecord"
	END PERFORM

Notes on the UpdateRecord Method:

  1. The UpdateRecord method updates the temporary area (copy buffer) of the database record when the ADODataSource control binds to ADO. When invoked UpdateRecord method does not write the new data into the database. The copy buffer is managed by the ADODataSource control.

  2. The copy buffer is written into the database just after invoking the Update method or UpdateBatch method of the ADO Recordset object (methods that are not PowerCOBOL methods but can be invoked from PowerCOBOL code using the syntax: INVOKE "Recordset" OF ADODataSource "...." USING ...).

  3. The copy buffer is written into the database just after changing the current record (cursor), for example, MoveNext, MovePrevious, MoveFirst, MoveLast, and Move methods of the Recordset object (as in 2, these methods are not PowerCOBOL methods, but can be invoked from PowerCOBOL code).

    The update can be canceled by invoking the CancelUpdate method if the copy buffer has not been written into the database (again this method is invoked using the syntax described in point 2 above).