How to: Perform Updates Using Buffers
After choosing the buffering method and the type of locking, you can enable record or table buffering.
To enable buffering
Choose one of the following options:
- In the Form Designer, set the BufferModeOverride property of the cursor in the data environment of the form.
-OR-
- Use the CURSORSETPROP( ) function to set the Buffering property.
For example, you can enable pessimistic row buffering by placing the following code in the Init procedure of a form:
CURSORSETPROP('Buffering', 2)
You then place code for the update operations in the appropriate method code for your controls.
To write edits to the original table, use the TABLEUPDATE( ) Function. To cancel edits after a failed update operation in a table constrained by rules, use TABLEREVERT( ) Function, which is valid even if explicit table buffering is not enabled. To specify a level of table integrity checking lower than the default setting, you can use the SET TABLEVALIDATE Command.
The following sample demonstrates how to update records when pessimistic record buffering is enabled.
Example of Updating Using Record and Table Buffers
Code | Comment |
---|---|
|
In the form Init code, open the table and enable pessimistic record buffering. |
|
Go through fields, checking for any field that's been modified. Note This code might be in the Click event of a "Save" or "Update" command button. |
|
Locate the next modified record. |
|
Present the current value and give the user the option to revert the change to the current field. |
|
SKIP guarantees that the last change is written. |
See Also
Reference
Update Criteria Tab, View Designer
DBSETPROP( ) Function
CURSORSETPROP( ) Function
Concepts
Buffering Data
Managing Conflicts When Updating Data