日期:2014-05-18  浏览次数:20403 次

sql事物
现要往3张表插入数据,想使用事物,该怎么写??
我传递的参是model

------解决方案--------------------


SQL code
begin try
begin tran
insert into a
insert into b
insert into b
if xact_state() =1
commit tran
else
rollback tran
end 
end try
begin catch
if xact_state()<>0
rollback tran
end catch

------解决方案--------------------
探讨

引用:
SQL code

begin try
begin tran
insert into a
insert into b
insert into b
if xact_state() =1
commit tran
else
rollback tran
end
end try
begin catch
if xact_state()<>0……

------解决方案--------------------
你这个问题可能不是提在SQL 区吧 。 你用的是什么?C#? Java? 还是其它什么 你想问的是这个吧。。。