连SQl简单地事务处理多表的情况 begin transaction declare @error int declare @QID int set @error = 0 insert into HW_Name (Name) values('{0}') 操作的SQL语句 set @QID=SCOPE_IDENTITY() 获得自增的ID set @error = @error + @@error insert into HW_Dep(NameId,DepName) values (@QID,'{…