下面的示例演示了如何使用 tableupdate( ) 函数实施对缓冲表的更改。先创建一个名为 employees 的表单,然后用 insert - sql 把“smith”插入到 clastname 字段中,multilocks 设置为 on,请求表缓冲。使用函数
cursorsetprop( ) 设置。缓冲方式为开放式表缓冲 (5)。先显示 clastname 字段的初始值(smith),接着用 replace 命令修改 clastname 字段,然后显示 clastname 字段的新值 (jones),最后用 tableupdate( )
实施对该表的更改(也可使用tablerevert( ) 函数实施更改),最后显示 clastname 字段值 (jones)。
close databases
create table employee (clastname c(10))
set multilocks on && 必须打开表缓冲
= cursorsetprop('buffering', 5, 'employee' ) && 启用表缓冲
insert into employee (clastname) values ('smith')
clear
? 'original clastname value: '
?? clastname && 显示 clastname 字段当前值(smith)
replace clastname with 'jones'
? 'new clastname value: '
?? clastname && 显示 clastname 新值(jones)
= tableupdate(.t.) && 实施更改
? 'updated clastname value: '
?? clastname && 显示当前 clastname 的值(jones)