private void button2_Click(object sender, EventArgs e)
{
try
{
string d = "select name,pass from pass where name='" + label1.Text + "' and pass='" + textBox6.Text + "'";
SqlCommand cmd1 = new SqlCommand(d, con);
con.Open();
SqlDataReader dr = cmd1.ExecuteReader();
if (dr.Read() == true)
{
dr.Close();
if (textBox3.Text == textBox4.Text)
{
string s = "update pass set pass='" + textBox4.Text + "' where pass='" + textBox6.Text + "' and name='" + label1.Text + "'";
SqlCommand cmd = new SqlCommand(s,con);
cmd.ExecuteNonQuery();
MessageBox.Show("entered succesfully");
}
else
{
MessageBox.Show("password mismatch");
}
}
else
{
MessageBox.Show("invalid currentpassword");
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
con.Close();
}
}
{
try
{
string d = "select name,pass from pass where name='" + label1.Text + "' and pass='" + textBox6.Text + "'";
SqlCommand cmd1 = new SqlCommand(d, con);
con.Open();
SqlDataReader dr = cmd1.ExecuteReader();
if (dr.Read() == true)
{
dr.Close();
if (textBox3.Text == textBox4.Text)
{
string s = "update pass set pass='" + textBox4.Text + "' where pass='" + textBox6.Text + "' and name='" + label1.Text + "'";
SqlCommand cmd = new SqlCommand(s,con);
cmd.ExecuteNonQuery();
MessageBox.Show("entered succesfully");
}
else
{
MessageBox.Show("password mismatch");
}
}
else
{
MessageBox.Show("invalid currentpassword");
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
con.Close();
}
}