Advertisement
Guest User

Untitled

a guest
May 29th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. con.Open();
  2. SqlCommand command = new SqlCommand("select 1 from tblLogin where Username = @user and Securityquestion = @securityquestion and Answer = @answer", con);
  3. command.Parameters.AddWithValue("@user", txtUsername.Text);
  4. command.Parameters.AddWithValue("@securityqestion", ddlSecurityquestions.Text);
  5. command.Parameters.AddWithValue("@answer", txtAnswer.Text);
  6.  
  7. var value = command.ExecuteScalar();
  8. con.Close();
  9.  
  10. if (Object.Equals(value, 1))
  11. {
  12. this.Hide();
  13. FormLoginWW2 ss = new FormLoginWW2();
  14. ss.Show();
  15. }
  16. else
  17. {
  18. MessageBox.Show("Error");
  19. }
  20.  
  21. //here it needs to be the username from the first form
  22. SqlCommand command;
  23. command = new SqlCommand("select THEUSERNAMEFROMFORM1 from tblLogin where Username = @user", con);
  24. command.Parameters.AddWithValue("@user", labelUsername.Text);
  25.  
  26. if (txtPassword.Text == txtConfirmpassword.Text)
  27. {
  28.  
  29. SqlCommand cmd = new SqlCommand("update tblLogin SET Password = @password where Username = @user ", con);
  30.  
  31. cmd.Parameters.AddWithValue("@password", txtPassword.Text);
  32.  
  33. MessageBox.Show("Succes");
  34.  
  35. this.Hide();
  36. FormLogin ss = new FormLogin();
  37. ss.Show();
  38. }
  39. else
  40. {
  41. MessageBox.Show("Error.");
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement