Delphi ADO的事务处理例子


本文整理自网络,侵删。

 
ADO的事务处理例子(Delphi)
ADOConnection1.BeginTrans;   //开始事务
try
with ADOCommand1 do
begin
Connection:=ADOConnection1;
commandtext:='update [country] set [population]=10000 where [name=''Venezuela''';//正确的SQL语句
Execute;
CommandText:='Wrong SQL Command';//错误的SQL Execute;
ADOConnection1.CommitTrans; //提交事务end;
except on E:
Exception do
begin
ADOConnection1.RollbackTrans; //如有异常,事务回滚ShowMessage(E.Message); end end;
end;
――――――――――――――――

原文链接:https://blog.csdn.net/zzflover/article/details/2481093

相关阅读 >>

Delphi xe 横屏竖屏的管理

Delphi treeview添加背景图片

Delphi获取系统特殊文件夹路径

Delphi 截取字符串的用法

firemonkey listbox 的几个事件:拖动,点击,长按

Delphi 秒计算分钟、小时函数

Delphi webservices传base64字串

maskedit中掩码的含义及使用

Delphi中tstringlist分割字符串的用法

Delphi getcurrentdir 获取当前文件夹

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...