SQL返回ID问题
create proc DingDan_Add(@VIPID varchar(50),@TaoXiID int,@ShopID int,@TaoXiText nvarchar(1000),@Time1 varchar(50),@Time2 varchar(50),@Time3 varchar(50),@BeiZhu nvarchar(1000),@DD_Type int,@DD_PayType int,@DD_Money float,@End int,@Give int,@ZengSongID int,--以下为Pay表数据@Pay_Money float,@InTime datetime,@JingShou int,@P1 int,@P2 int,@P3 int,@P4 int,@Pay_Type int,@Pay_PayType int)asDECLARE @Error_DingDan int,@Error_Pay int,@Error_EditVIPScore int,@Error_ZengSong int,@Error_ZengSongDingDan int,@DingDanID int,@ZengSongDingDanID int,@ZengSongTaoXiText nvarchar(1000)begin transaction DingDaninsert DingDan values(@VIPID,@TaoXiID,@ShopID,@TaoXiText,@Time1,@Time2,@Time3,@BeiZhu,@DD_Type,@DD_PayType,@DD_Money,@End,@Give)Set @DingDanID=@@identitySet @Error_DingDan=@@Errorif(@ZengSongID>0)Set @ZengSongTaoXiText=(select T_Text from TaoXi where T_ID=@ZengSongID)if(@ZengSongID>0)insert DingDan values(@VIPID,@ZengSongID,@ShopID,@ZengSongTaoXiText,'','','','',@DD_Type,0,0,@End,0)Set @ZengSongDingDanID=@@identitySet @Error_ZengSongDingDan=@@Errorif(@ZengSongID>0)insert ZengSong values(@DingDanID,@ZengSongDingDanID)Set @Error_ZengSong=@@Errorinsert Pay values(@DingDanID,@Pay_Money,@InTime,@JingShou,@P1,@P2,@P3,@P4,@Pay_Type,@Pay_PayType)Set @Error_Pay=@@Errorupdate VIP Set V_Score=V_Score+@Pay_Money where V_ID=@VIPIDSet @Error_EditVIPScore=@@Errorif @Error_DingDan>0 or @Error_Pay>0 or @Error_EditVIPScore>0 or @Error_ZengSong>0 or @Error_ZengSongDingDan>0beginRollback transaction DingDanendelsecommit transaction DingDango