mycomm=newMySqlCommand("sp_luckdraw",myco);mycomm.CommandType=CommandType.StoredProcedure;MySqlParametermyParameter=newMySqlParameter("@prizeCode",MySqlDbType.VarChar,50)...
mycomm = new MySqlCommand("sp_luckdraw", myco);
mycomm.CommandType = CommandType.StoredProcedure;
MySqlParameter myParameter = new MySqlParameter("@prizeCode",MySqlDbType.VarChar, 50);
myParameter.Value = strValue.ToUpper();
myParameter.Direction = ParameterDirection.Input;
mycomm.Parameters.Add(myParameter);
MySqlParameter myParameter2 = new MySqlParameter("@result", MySqlDbType.Int32);
myParameter2.Direction = ParameterDirection.Output;
mycomm.Parameters.Add(myParameter2);
using (dr = mycomm.ExecuteReader(CommandBehavior.CloseConnection))
{
string strResult1 = myParameter2.Value.ToString();
while (dr.Read())
{
string strResult = dr["result"].ToString();
}
}
请我为什么传出参数myParameter2.Value是null,怎么解决。(存储过程在mysql数据库执行没问题)
展开