예제 #1
0
        private void button7_Click(object sender, EventArgs e)
        {
            this.Hide();
            frm_DashBoard openDashoard = new frm_DashBoard(lblWelcome.Text);

            openDashoard.ShowDialog();
        }
예제 #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            this.Hide();
            frm_DashBoard dashboardOpen = new frm_DashBoard(lblWelcome.Text);

            dashboardOpen.ShowDialog();
        }
예제 #3
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            if (txt_Username.Text == "")
            {
                MessageBox.Show("Please enter your Username", "Login Error");
            }
            else if (txt_Password.Text == "")
            {
                MessageBox.Show("Please enter your Password", "Login Error");
            }
            else
            {
                connection.Open();
                OleDbCommand command = new OleDbCommand();
                command.Connection  = connection;
                command.CommandText = "select * from UserData where Username='******' and Pw='" + txt_Password.Text + "'";

                OleDbDataReader reader = command.ExecuteReader();
                int             count  = 0;
                while (reader.Read())
                {
                    count = count + 1;
                }
                if (count == 1)
                {
                    MessageBox.Show("Welcome " + txt_Username.Text + "!", "Login Successful");
                    connection.Close();
                    connection.Dispose();
                    this.Hide();
                    frm_DashBoard dashboardOpen = new frm_DashBoard(txt_Username.Text);
                    dashboardOpen.ShowDialog();
                }
                else if (count > 1)
                {
                    MessageBox.Show("Duplicate Username and Password");
                    connection.Close();
                }
                else
                {
                    MessageBox.Show("Username or Password is Incorrect", "Login Failed");
                    connection.Close();
                }
            }
        }