C# 接受返回值判断问题
[bo]存储过程[/bo] CREATE PROCEDURE pd_name @userName char,@userPass int ,@m int outputas select m=count(*) from name where 用户名=@userName and 密码=@userPass
GO
[bo]C#[/bo]
SqlConnection conn = new SqlConnection("server=localhost;uid=sa;pwd=s;database=s");
SqlCommand cmd = new SqlCommand("pd_name", conn);
= CommandType.StoredProcedure;
cmd.Parameters.Add("@userName", SqlDbType.Char, 20);
cmd.Parameters["@userName"].Value = textBox1.Text;
cmd.Parameters.Add("@userPass", SqlDbType.Int, 4);
cmd.Parameters["@userPass"].Value = textBox2.Text;
cmd.Parameters.Add("@m", SqlDbType.Int, 4);
cmd.Parameters["@m"].Direction = ParameterDirection.Output;
conn.Open();
int val = 1;
int val=cmd.ExecuteNonQuery();接收不到值
conn.Close();
if (val==1)
form1.Show();
else
MessageBox.Show("帐号或密码错误");