2023年6月21日发(作者:)
.NETCOREEF框架调⽤存储过程//查 获取信息string userId =888886868886; //多个参数多表组合值 SqlParameter[] Param = { new SqlParameter("@UserId", r) }; if (OrEmpty(userId)) { Param[0].Value = ; } else { Param[0].Value = userId; } var userdata = await _Async("SP_GetList", Param); ///
return numint;
}//增删改 SqlParameter[] Param = { new SqlParameter("@MobilePhone", r), new SqlParameter("@PayPrice", r), new SqlParameter("@rt_code", ar, 20), new SqlParameter("@rt_msg", ar, 200), //输出⼀定要定义字符类型长度 以免报错 }; if (OrEmpty(strMobilePhone)) { Param[0].Value = ; } else { Param[0].Value = strMobilePhone; } Param[1].Value = strPayPrice; if (OrEmpty(strParkUserId)) { Param[2].Value = ; } else { Param[2].Value = strParkUserId; }
Param[2].Direction = ; Param[3].Direction = ; int numdata = await _eNonQueryAsync("SP_Pay", Param); string rtcode = Param[2].ng(); string rtmessage = Param[3].ng(); if (numdata < 0) { return (32(rtcode), rtmessage); } 存储过程代码:ALTER PROCEDURE [dbo].[SP_GetList]
(
@UserId varchar(100)
)
AS
BEGIN
begin transaction begin try BEGIN SELECT DISTINCT
* FROM UserInfo_test usertest where =@UserID ORDER BY DESC;
END commit transaction end try
----------------------------------------------------------------------------------------------------------------------------begin catch print '执⾏存储异常' rollback transaction
end catch
ENDCREATE PROCEDURE [dbo].[SP_Pay]
( @MobilePhone varchar(50), @PayPrice varchar(100) , @ParkUserId varchar(50), @rt_code varchar(20) output, @rt_msg nvarchar(200) output
)AS --declare @rt_code varchar(50); --声明变量 declare @before_overprice DECIMAL(9,2); declare @P_overprice DECIMAL(9,2);--变化后余额 declare @YuanPayPwd nvarchar(100);
BEGIN ; select @before_overprice=isnull(OveragePrice,0) FROM Meb_Overage WHERE ParkUserId=@ParkUserId; IF (@PayPrice is null)
BEGIN set @rt_code= '1001'; set @rt_msg= '⽀付⾦额不能为空!'; RETURN; END; IF (@before_overprice=0)
BEGIN BEGIN set @rt_code= '1001'; set @rt_msg= '账户余额不⾜!'; RETURN; END;
IF (@PayPrice>@before_overprice)
BEGIN set @rt_code= '1001'; set @rt_msg= '当前账户余额不⾜!'; RETURN; END; begin transaction begin try
if(@ParkUserId is not null)
BEGIN update Meb_Overage set OveragePrice=(OveragePrice-@PayPrice) WHERE ParkUserId = @ParkUserId ;
---⽀付后⾦额 select @P_overprice=isnull(OveragePrice,0) FROM Meb_Overage WHERE ParkUserId=@ParkUserId; INSERT INTO Meb_Details(ParkUserId, PayPrice, AddTime , BalanceStatus
) VALUES ( @ParkUserId, @PayPrice, --缴费⽀付⾦额 SYSDATETIME(),-- CONVERT(varchar(100), GETDATE(), 120) '0'--默认 ); END; commit transaction set @rt_code= '0000'; set @rt_msg= '交易成功!'; return end try
begin catch set @rt_code= '9999'; set @rt_msg= '交易失败!';
rollback transaction end catchEND
转载于:/Warmsunshine/p/
2023年6月21日发(作者:)
.NETCOREEF框架调⽤存储过程//查 获取信息string userId =888886868886; //多个参数多表组合值 SqlParameter[] Param = { new SqlParameter("@UserId", r) }; if (OrEmpty(userId)) { Param[0].Value = ; } else { Param[0].Value = userId; } var userdata = await _Async("SP_GetList", Param); ///
return numint;
}//增删改 SqlParameter[] Param = { new SqlParameter("@MobilePhone", r), new SqlParameter("@PayPrice", r), new SqlParameter("@rt_code", ar, 20), new SqlParameter("@rt_msg", ar, 200), //输出⼀定要定义字符类型长度 以免报错 }; if (OrEmpty(strMobilePhone)) { Param[0].Value = ; } else { Param[0].Value = strMobilePhone; } Param[1].Value = strPayPrice; if (OrEmpty(strParkUserId)) { Param[2].Value = ; } else { Param[2].Value = strParkUserId; }
Param[2].Direction = ; Param[3].Direction = ; int numdata = await _eNonQueryAsync("SP_Pay", Param); string rtcode = Param[2].ng(); string rtmessage = Param[3].ng(); if (numdata < 0) { return (32(rtcode), rtmessage); } 存储过程代码:ALTER PROCEDURE [dbo].[SP_GetList]
(
@UserId varchar(100)
)
AS
BEGIN
begin transaction begin try BEGIN SELECT DISTINCT
* FROM UserInfo_test usertest where =@UserID ORDER BY DESC;
END commit transaction end try
----------------------------------------------------------------------------------------------------------------------------begin catch print '执⾏存储异常' rollback transaction
end catch
ENDCREATE PROCEDURE [dbo].[SP_Pay]
( @MobilePhone varchar(50), @PayPrice varchar(100) , @ParkUserId varchar(50), @rt_code varchar(20) output, @rt_msg nvarchar(200) output
)AS --declare @rt_code varchar(50); --声明变量 declare @before_overprice DECIMAL(9,2); declare @P_overprice DECIMAL(9,2);--变化后余额 declare @YuanPayPwd nvarchar(100);
BEGIN ; select @before_overprice=isnull(OveragePrice,0) FROM Meb_Overage WHERE ParkUserId=@ParkUserId; IF (@PayPrice is null)
BEGIN set @rt_code= '1001'; set @rt_msg= '⽀付⾦额不能为空!'; RETURN; END; IF (@before_overprice=0)
BEGIN BEGIN set @rt_code= '1001'; set @rt_msg= '账户余额不⾜!'; RETURN; END;
IF (@PayPrice>@before_overprice)
BEGIN set @rt_code= '1001'; set @rt_msg= '当前账户余额不⾜!'; RETURN; END; begin transaction begin try
if(@ParkUserId is not null)
BEGIN update Meb_Overage set OveragePrice=(OveragePrice-@PayPrice) WHERE ParkUserId = @ParkUserId ;
---⽀付后⾦额 select @P_overprice=isnull(OveragePrice,0) FROM Meb_Overage WHERE ParkUserId=@ParkUserId; INSERT INTO Meb_Details(ParkUserId, PayPrice, AddTime , BalanceStatus
) VALUES ( @ParkUserId, @PayPrice, --缴费⽀付⾦额 SYSDATETIME(),-- CONVERT(varchar(100), GETDATE(), 120) '0'--默认 ); END; commit transaction set @rt_code= '0000'; set @rt_msg= '交易成功!'; return end try
begin catch set @rt_code= '9999'; set @rt_msg= '交易失败!';
rollback transaction end catchEND
转载于:/Warmsunshine/p/
发布评论