title: want to compare the text entered in textbox with the sql column, and to pull the other values from that row, if the values matches using asp.net c#
body: <p>I want to compare the data entered in <code>textbox</code> with the column data in the <code>SQL</code>.if the <code>text</code> entered matches with the <code>text</code> present in the <code>sql column</code>, then i want to pull some values present in that row to the front end.</p>
  
  <p><strong>below Code not working :</strong></p>
  
  <pre><code>protected void Button2_Click(object sender, EventArgs e){
        SqlDataReader reader = null;
        SqlConnection conn = new SqlConnection("Data Source=PRATHAP-GENNY\\SQLEXPRESS;Initial Catalog=Testing;Integrated Security=True");
        conn.Open();
        SqlCommand cmd = new SqlCommand("select barcodetest from Testtable where @barcodetest='" + barcode.Text + "'", conn);
        cmd.Parameters.AddWithValue("@barcodetest", barcode.Text);
        reader = cmd.ExecuteReader();
       if (reader != null &amp;&amp; reader.HasRows)
          {
       //email exists in db do something
              TextBox2.Visible = true;
  
          }
       else
         {
  
       TextBox3.Visible = true;
          }
  
    }
  </code></pre>