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 非常简单的字符串加密解密函数,支持中文

Delphi 写日志函数

Delphi 大小写字符串转换

Delphi trayicon1如何把窗体关闭到系统托盘

Delphi的tclientsocket组件和tserversocket组件(c/s)说明

Delphi 多核机器上编程实现将指定进程pid放到指定cpu上运行

maskedit中掩码的含义及使用

Delphi 通过递归来实现搜索文件

Delphi实现获取密码框中的密码

Delphi 如何在窗体标题栏添加按钮

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



打赏

取消

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

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

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

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

评论

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