Guest User

Untitled

a guest
Feb 28th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. private void btnLogIn_Click(object sender, EventArgs e)
  2. {
  3. try
  4. {
  5. OleDbCommand command = new OleDbCommand("select * from Account where UserName = '" + txtbxUserName.Text + "' and Password = '" + txtbxPassword.Text + "' ");
  6.  
  7. OleDbDataReader theReader;
  8.  
  9. conn.Open();
  10. theReader = command.ExecuteReader();
  11. int count = 0;
  12. string uType = string.Empty;
  13. while (theReader.Read())
  14. {
  15. count = count + 1;
  16. uType = theReader["UserType"].ToString();
  17. }
  18. if (count == 1)
  19. {
  20. MessageBox.Show("Username and Password . . . is Correct", "Confirmation Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  21. this.Hide();
  22. if (uType == "Admin")
  23. {
  24. B_E backend = new B_E();
  25. this.Hide();
  26. backend.ShowDialog();
  27. }
  28. else
  29. {
  30. this.Close();
  31. }
  32. }
  33. }
  34. catch(Exception ex)
  35. {
  36. MessageBox.Show(ex.Message);
  37. }
Add Comment
Please, Sign In to add comment