ASP.NET reading from database
<p>here's the problem:</p>

<p>I wanna make that if the value is the same that is the <code>TextBox2.Text</code> and in <code>Label2.Text</code>, I would not get redirected to the next page but instead I'd be asked to enter different text.Here's my code:</p>

<pre><code>protected void Button1_Click(object sender, EventArgs e)
{
   con.Open();
   SqlCommand cmd = new SqlCommand();
   cmd.Connection = con;
   cmd = new SqlCommand("SELECT Question FROM Animals WHERE Question = @Question", con);
   cmd.Parameters.AddWithValue("@Question", Label2.Text);
   cmd.ExecuteNonQuery();
   dr = cmd.ExecuteReader();

   if (dr.Read())
   {
      Response.Write("Enter different question");
   }
   else
   {
      if(dr[0].ToString() != TextBox2.Text)
         Session["question"] = Label2.Text;
         Session["Animal3"] = TextBox1.Text;
         Session["Question2"] = TextBox2.Text;
         Session["Animal2"] = Label3.Text;
         Session["Animal"] = Label4.Text;

         Response.Redirect("~/StartGame2.aspx");
   }
</code></pre>
