标签:
--存储过程
ALTER PROCEDURE testTrans1
(@rtn INT OUTPUT)
AS
BEGIN TRAN
IF(2<3)
BEGIN
ROLLBACK TRAN
SET @rtn=0;
RETURN @rtn;
END
commit tran
SET @rtn=1;
RETURN @rtn;
DECLARE @rtn INT
EXEC testTrans1 @rtn OUT
PRINT @rtn
------------------------------------------------------------
c#代码
SqlParameter[] parameters = {
new SqlParameter("@rtn",SqlDbType.Int)
};
parameters[0].Direction = ParameterDirection.Output;
DalBase.ExecuteNonQuery(CommandType.StoredProcedure, "testTrans1", parameters);
int nRtnNum = 0;
nRtnNum = Convert.ToInt32(parameters[0].Value);
标签:
原文地址:http://www.cnblogs.com/caohuimingfa/p/4475841.html