Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static bool Authentication(string login, string password)
- {
- try
- {
- using (MySqlConnection con = new MySqlConnection())
- {
- con.ConnectionString = connectionString;
- con.Open();
- using (MySqlCommand com = new MySqlCommand(string.Format("SELECT * FROM Office_workers"), con))
- {
- MySqlDataReader dr = com.ExecuteReader();
- while (dr.Read())
- {
- if (dr["Login"].ToString() == login && dr["Password"].ToString() == password)
- {
- int ret = int.Parse(dr["id"].ToString());
- con.Close();
- return true;
- }
- }
- }
- con.Close();
- }
- }
- catch (Exception ex){}
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement