コード例 #1
0
        private void btnlogin_Click(object sender, EventArgs e)
        {
            if (txtuser.Text == "")
            {
                MessageBox.Show(" Username tidak boleh kosong ");
            }
            else if (txtpass.Text == "")
            {
                MessageBox.Show(" Password tidak boleh kosong ");
            }
            else
            {
                dbconn.koneksidb();

                sql = " select * from adminprogram where username ='******' and password='******'";
                MySqlCommand    command = new MySqlCommand(sql, dbconn.connection);
                MySqlDataReader reader  = command.ExecuteReader();

                if (reader.Read())
                {
                    MessageBox.Show("Login Berhasil");

                    MenuAdmin menu = new MenuAdmin();
                    menu.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Username dan Password tidak cocok", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtuser.Text = "";
                    txtpass.Text = "";
                    txtuser.Focus();
                }
                dbconn.closeConnection();
            }
        }
コード例 #2
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            MenuAdmin menu = new MenuAdmin();

            menu.ShowDialog();
        }