this is my code trying to compare the strings in the text box2 and display the matched string in the label i am getting an error please help me
protected void Button1_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("insert comparative values('" + TextBox1.Text + "','" + TextBox2.Text + "')", con);
cmd.ExecuteNonQuery();
SqlDataReader reader = null;
// cmd.Parameters.AddWithValue("@name", TextBox2.Text);
//cmd.Parameters.AddWithValue("SELECT FROM places where name=@name",TextBox2.Text);
cmd.Parameters.AddWithValue("select textbox2.text from places where
[email protected]",con);
reader = cmd.ExecuteReader();
while (reader.Read())
{
TextBox2.Visible = true;
TextBox2.Text = Convert.ToString(reader["TextBox2"]);
}
Label4.Text= TextBox2.Text;
con.Close();
}