22,207
社区成员
发帖
与我相关
我的任务
分享
sql+=@"BEGIN TRANSACTION
begin
if not exists(select * from B_ArchiveList where relationInfo=@relation and status='true')
begin
Insert into B_ArchiveList(archiveName,relationInfo,bolNecessary,createDate,modifyDate) values(@name,@relation,@necessary,@createDate,@modifyDate)
end
if @@error<>0
begin
ROLLBACK TRANSACTION
return
end
end
begin
";
for(int i=0;i<list.Count;i++)
{
sql+=@" update T_PersonInfo set stateFlag=@stateFlag"+i+" where stateFlag=@state"+i;
}
sql+=@"
if @@error<>0
begin
ROLLBACK TRANSACTION return
end
end
COMMIT TRANSACTION
";
begin
Insert into B_ArchiveList ...
if @@error<>0
begin
ROLLBACK TRANSACTION
return
end
end
begin
Insert into B_ArchiveList ...
if @@error<>0
begin
ROLLBACK TRANSACTION
return
end
end