未能取到SqL存储过程返回值,请高手给个理由
存储过程
CREATE PROCEDURE TB_Get
@ID int output
AS
select * from TB
set @ID=5
GO
C#代码
SqlDataReader SDR = null;
SqlConnection SC = new SqlConnection(SQLStr);
SC.Open();
SqlCommand SCD = new SqlCommand("TB_Get", SC);
SCD.CommandType = CommandType.StoredProcedure;
SCD.Parameters.Add("@ID", SqlDbType.Int);
SCD.Parameters["@ID"].Direction = ParameterDirection.Output;
SDR = SCD.ExecuteReader();
object str = SCD.Parameters["@ID"].Value;
str的值为null
实在想不通是什么原理,请高手指点一下