首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

sql事物,该怎么处理

2012-04-11 
sql事物现要往3张表插入数据,想使用事物,该怎么写??我传递的参是model[解决办法]SQL codebegin trybegin t

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? 还是其它什么 你想问的是这个吧。。。

热点排行