使用updatebatch 更新批处理
用cancelbatch 取消批处理
ADO的批更新等效于BDE的缓存更新技术
用cancelbatch 取消批处理
ADO的批更新等效于BDE的缓存更新技术
解决方案 »
- delphi7到delphi2010升级碰到问题
- 求delphi7 “delphi cannot focus a disabled or invisible window”的办法
- 救命哪!!!!!救命哪!!!!!救命哪!!!!!救命哪!!!!!救命哪!!!!!救命哪!!!!!救命哪!!!!!
- ACCESS数据库查询时间的问题,请进,急~搞定马上结~
- 关于interbase注册服务器
- 百分大放送,非牛莫入!
- 如何在我运行程序的时候不出现 输入用户名和密码的提示框?
- 装了一次D7Trial,再装上BOLD FOR DELPHI,失望
- 《C++程序设计(谭浩强) 》电子书下不了,我用手机看的
- 大家快来发言!评书:《Delphi技术手册》
- 日期比较问题
- 用delphi5.0写的程序在delphi6.0中一定能运行吗?
能否给个简单的例子呀?
以query1为例
1.设置query1的属性:LockType=ltBatchOptimistic;
2.保存:query1.UpdateBatch(arAll);//或其他参数如arCurrent
3.取消:query1.CancelBatch(arAll); //arCurrent
ok?
with adoquery1 do
begin
close;
locktyp:=ltbatchoptimistic;
sql.clear;
sql.add('insert into table1 select * from table2');
execsql;
try
updatebatch(arall);
except
cancelbatch(arall);
end;
end;
with adoquery1 do
begin
cursorlocation:=clUseServer;
CursorType:=ctkeySet;
LockType:=ltBatchOptimistic;
sql.add('select * from table1');
open;
if recordcount>0 then
begin
first;
while not eof do
begin
edit;
fieldbyname('myName').asstring:='myName';
post;
next;
end;//while not eof
adoconnection1.beginTrans;
try
UpdateBatch(arAll);
adoconnection1.commitTrans;
except
CancelBatch(arAll);
adoconnection1.RollbackTtrans;
end;//try
end;//if recordcount>0
end;//with adoquery1 do