[存储过程]
CREATE procedure p_getQfromQ @STCD char,@STCD_M char,@ref float,@Q_M float,@Q float output
as
declare @Q_MH float,@Q_M0 float,@Q_ML float
declare @QH float,@Q0 float,@QL float
if @Q_M < (select min(Qm) from st_f_xianggliul where stcd = @STCD and stcdm=@STCD_M and ref=@ref)
begin
set @Q = 0
return -1
end
……
GO
现在我想调用它返回其中的output值,也就是◎Q值。
【调用程序】
public double InsertQ(string czy,string czg,double re,double qy)
{
double qq=0;
double result;
SqlConnection objConnection = new SqlConnection(strConnection);
objConnection.Open();
SqlCommand cmm = new SqlCommand("p_getQfromQ", objConnection);
cmm.CommandType = CommandType.StoredProcedure;
cmm.Parameters.Add("@stcd", czy);
cmm.Parameters[“@stcd”].Direction =ParameterDirection.Input;
cmm.Parameters.Add("@stcd_m", czg);
cmm.Parameters[“@stcd_m”].Direction =ParameterDirection.Input;
cmm.Parameters.Add("@ref", re);
cmm.Parameters[“@ref”].Direction =ParameterDirection.Input;
cmm.Parameters.Add("@Q_M", qy);
cmm.Parameters[“@Q_M”].Direction =ParameterDirection.Input;
cmm.Parameters.Add("@Q", qq);
cmm.Parameters[“@Q”].Direction =ParameterDirection.Output;
cmm.ExecuteNonQuery();
result = cmm.Parameters[“@Q”].Value;
objConnection.Close();
return result;
}
[求助]:请大家帮忙看看这个存储过程的调用有什么问题!!