Exemplo n.º 1
0
        static public int FindUser(string userName, string password)
        {
            MySqlConnection C = new MySqlConnection(SqlUpdater.conString);

            C.Open();
            MySqlCommand    cmd = new MySqlCommand($"SELECT userId FROM user WHERE userName = '******' AND password = '******'", C);
            MySqlDataReader rdr = cmd.ExecuteReader();

            if (rdr.HasRows)
            {
                rdr.Read();
                SqlUpdater.setCurrentUserID(Convert.ToInt32(rdr[0]));
                SqlUpdater.setCurrentUserName(userName);
                rdr.Close();
                return(SqlUpdater.getCurrentUserID());
            }
            return(0);
        }