Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. public static bool Authentication(string login, string password)
  2. {
  3. try
  4. {
  5. using (MySqlConnection con = new MySqlConnection())
  6. {
  7. con.ConnectionString = connectionString;
  8. con.Open();
  9. using (MySqlCommand com = new MySqlCommand(string.Format("SELECT * FROM Office_workers"), con))
  10. {
  11. MySqlDataReader dr = com.ExecuteReader();
  12. while (dr.Read())
  13. {
  14. if (dr["Login"].ToString() == login && dr["Password"].ToString() == password)
  15. {
  16. int ret = int.Parse(dr["id"].ToString());
  17. con.Close();
  18. return true;
  19. }
  20. }
  21. }
  22. con.Close();
  23. }
  24. }
  25. catch (Exception ex){}
  26. return true;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement