在dataacess中找到控件 updatesql 然后把query的cacheupdate设为真,query的updateobject 连接updatesql控件
在updatesql编辑选则关键字应该ok了。在保存按钮中写如下代码
begin
with CustomerQuery do
begin
Database1.StartTransaction;
try
ApplyUpdates; {try to write the updates to the database};
Database1.Commit; {on success, commit the changes};
except
Database1.Rollback; {on failure, undo the changes};
raise; {raise the exception to prevent a call to CommitUpdates!}
end;
CommitUpdates; {on success, clear the cache}
end;
end;