i am using this code for changing password when i enter correct password its ok password is updated. but when i enter wrong password no error messag is shown whats wrong with code
private void button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = (@"Data Source=heaven_prince20;Initial Catalog=final_pr;Integrated Security=True");
con.Open();
SqlCommand cmd = new SqlCommand("SELECT password FROM login WHERE Password='" +Convert.ToInt32( textBox1.Text )+ "'", con);
cmd.ExecuteNonQuery();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
if ((Convert.ToInt32( (dr["password"])) !=Convert.ToInt32( ( textBox1.Text))||Convert.ToInt32( textBox2.Text)!=Convert.ToInt32( textBox3.Text)))
{
MessageBox.Show("old password is worng");
}
else
{
dr.Close();
SqlCommand cmd1 = new SqlCommand("UPDATE login SET password='" + Convert.ToInt32(textBox2.Text) + "' WHERE password='" + textBox1.Text + "'", con);
cmd1.ExecuteNonQuery();
MessageBox.Show("Record Update Successfully");
}