I'm trying to change password for currently logged user and I would like to know how to manage that?
I have tried this query but each time when I pass good password combination or bad one(in textBox1
) I get positive response.
How to catch negative update from database in this case?
SqlConnection conn= new SqlConnection(Conn.CS);
SqlCommand comm= new SqlCommand();
comm.CommandText= "update User set Pass= '" + textBox2.Text + "' where Pass= '" + textBox1.Text + "' and id=" + Korisnik.ID + "";
comm.Connection = konekcija;
try
{
conn.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Success yaaay!", "Info");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}