Пример #1
0
        private void btnLogin_Click_1(object sender, EventArgs e)
        {
            List <MySqlParameter> paramList = new List <MySqlParameter>();

            paramList.Add(new MySqlParameter("@userName", txtLoginUsername.Text));
            paramList.Add(new MySqlParameter("@password", txtLoginPw.Text));
            int returnedRowCount = DatabaseHandler.returnRowCount("SELECT * FROM tbladmin WHERE userName=@userName and password=@password", paramList);

            if (returnedRowCount != 1)
            {
                GlobalLoginData.userName = txtLoginUsername.Text;
                paramList.Clear();
                //paramList.Add(new MySqlParameter("@username", txtLoginUsername.Text));
                //GlobalLoginData.userRole = DatabaseHandler.returnOneValue("SELECT userRole FROM tbladmin WHERE userName = @userName", paramList, "userName");

                this.Hide();
                frmHomepage dash = new frmHomepage();
                dash.Show();
            }
            else
            {
                MessageBox.Show("Invalid Data! Please Try Again!");
                txtLoginPw.Clear();
                txtLoginUsername.Clear();
            }
        }
Пример #2
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmHomepage home = new frmHomepage();

            home.Show();
        }