コード例 #1
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            string username = usernameBox.Text;
            string password = passwordBox.Text;

            conn.Open();
            OleDbCommand comm = new OleDbCommand();

            comm.Connection  = conn;
            comm.CommandText = "SELECT PermissionType FROM Logins WHERE Username= '******' and Password= '******'";
            OleDbDataReader reader = comm.ExecuteReader();

            while (reader.Read())
            {
                permission = (reader["PermissionType"].ToString());
            }
            if (permission.Equals("Clerical"))
            {
                Clerical clerk = new Clerical();
                clerk.Show();
            }
            else if (permission.Equals(""))
            {
                MessageBox.Show("Incorrect username or password");
            }

            conn.Close();
        }
コード例 #2
0
        private void clericalFormToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Clerical nClerical = new Clerical();

            //Opens nClerical form in the MDI container
            nClerical.MdiParent = this;
            nClerical.Show();
        }