예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            con = new OleDbConnection(spath);
            con.Open();
            string           Q  = "Select * from users where username='******' And password='******'";
            OleDbDataAdapter ds = new OleDbDataAdapter(Q, con);

            DataTable dt = new DataTable();

            dt = new DataTable();
            ds.Fill(dt);
            if ((uname_text.Text == String.Empty) || (password_text.Text == String.Empty))
            {
                MessageBox.Show("Please enter username and password!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else if (dt.Rows.Count > 0)
            {
                //then the result will get the name of the user and display it in the form using label control.
                MessageBox.Show("Login Successful!", "Congratulation!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Hide();
                Menu_form mf = new Menu_form();
                mf.Show();
            }
            else
            {
                MessageBox.Show("Please enter a valid username and password!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void closebtn_Click(object sender, EventArgs e)
        {
            this.Hide();
            Menu_form mf = new Menu_form();

            mf.Show();
        }