nayer2
چهارشنبه 13 مرداد 1389, 09:19 صبح
با سلام
کد زیر error میده لطفا راهنمایی کنید
protected void Button3_Click(object sender, EventArgs e)
{
Label9.Visible = false;
bool flag = true;
SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrin gs["CS"].ToString());
try
{
connect.Open();
SqlCommand concmd = new SqlCommand("", connect);
string pass = TextBox2.Text.GetHashCode().ToString();
concmd.CommandText = "select * from Table_1 where [user]=@user and [pas]=@pas";
concmd.Parameters.AddWithValue("user", TextBox1.Text.Trim());
concmd.Parameters.AddWithValue("pas", pass);
SqlDataReader dr = concmd.ExecuteReader();
}
catch
{
Label9.Visible = true;
}
if (dr.Read())
{
flag = false;
lblerror.Text = " ";
}
Error 1 The name 'dr' does not exist in the current context
کد زیر error میده لطفا راهنمایی کنید
protected void Button3_Click(object sender, EventArgs e)
{
Label9.Visible = false;
bool flag = true;
SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrin gs["CS"].ToString());
try
{
connect.Open();
SqlCommand concmd = new SqlCommand("", connect);
string pass = TextBox2.Text.GetHashCode().ToString();
concmd.CommandText = "select * from Table_1 where [user]=@user and [pas]=@pas";
concmd.Parameters.AddWithValue("user", TextBox1.Text.Trim());
concmd.Parameters.AddWithValue("pas", pass);
SqlDataReader dr = concmd.ExecuteReader();
}
catch
{
Label9.Visible = true;
}
if (dr.Read())
{
flag = false;
lblerror.Text = " ";
}
Error 1 The name 'dr' does not exist in the current context