事务中执行了三个SQL语句,其中的一个执行语句失败,事务为什么没有回滚。语句如下.
事务中执行了三个SQL语句,其中的一个执行语句失败,事务为什么没有回滚。语句如下.
其中insert into tblPeelScroll(ScrollBar,PeelDate,PeelMan)
values('123','0002','2005-12-07 11:21:27'); 这一句是错误的。他为什么没有回滚。是不是我自己要做判断。谢谢!!
cn.Open gConnstr
cn.BeginTrans
cn.Execute "IF exists(select ScrollBar from TblStorage where ScrollBar='0050905110050451562125203129')
begin
update TblStorage set Status=2 ,UpdateID='0001',UpdateTime='2005-12-07 11:21:27' where ScrollBar='0050905110050451562125203129';
insert into tblPeelScroll(ScrollBar,PeelDate,PeelMan)
values('123','0002','2005-12-07 11:21:27');
insert into tblScrollLog(ScrollBar,CodeID,ShelfID,WareHouseID,SAction,UserID,ActDate,UpdateID)
select ScrollBar,CodeID,ShelfID,WareHouseID,'2','0002',getdate(),'0001' from TblStorage where ScrollBar='123'
end "
cn.CommitTrans