ADO的事务处理例子(Delphi)
2008-05-26 09:01
375 查看
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;
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;
相关文章推荐
- DELPHI DATASNAP 入门操作(3)简单的主从表的简单更新【含简单事务处理】
- sqlite处理事务的一个例子
- 使用ADO.NET配置SQLServer事务处理
- ADO事务处理方式运行正常
- 黑马程序员之ADO.NET学习笔记:网络数据的事务处理
- ADO.NET事务处理
- .NET开发中的事务处理大比拼 之 ADO.NET级别的事务
- delphi 事务处理效率
- delphi事务处理
- .net下 存储过程、事务处理 的一个小例子
- Ado.Net事务处理。
- ADO.NET2.0中的事务处理
- 使用Ado.Net进行简单事务处理的四种实现及比较
- dotnet下ADO 操作 SQLServer 事务处理
- ASP.NET里的事务处理(ado.net 数据库应用)
- ADO.NET事务处理
- ado.net 事务 处理 锁定数据行
- ado.net 分布式事务处理示例,及微软官方示例
- ADO.NET两种事务处理方法
- ADO.NET事务处理-數據存取時忽發事件處理