C#返回值判断问题
这是存储过程CREATE PROCEDURE pd_name @userName char,@userPass int ,@m int outputas select m=count(*) from name where 用户名=@userName and 密码=@userPass
GO
C#内容
Form form1 = new Form2();
SqlConnection conn = new SqlConnection("server=localhost;uid=sa;pwd=8;database=n");
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();
cmd.ExecuteNonQuery();
if (返回值==1)
form1.Show();
else if (返回值 == 0)
MessageBox.Show("帐号或密码错误");
[[it] 本帖最后由 update2610 于 2008-10-12 17:12 编辑 [/it]]