读书人

sql事物,该怎么处理

发布时间: 2012-04-11 17:42:33 作者: rapoo

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

[解决办法]


SQL code
begin trybegin traninsert into ainsert into binsert into bif xact_state() =1commit tranelserollback tranend end trybegin catchif xact_state()<>0rollback tranend 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? 还是其它什么 你想问的是这个吧。。。

读书人网 >SQL Server

热点推荐