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

                sql = " select * from petugas where id_petugas ='" + txtuser.Text + "' and password='******'";
                MySqlCommand    command = new MySqlCommand(sql, dbconn.connection);
                MySqlDataReader reader  = command.ExecuteReader();

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

                    MenuPetugas menu = new MenuPetugas();
                    menu.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Username dan Password tidak cocok", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtuser.Text = "";
                    txtpass.Text = "";
                    txtuser.Focus();
                }
                dbconn.closeConnection();
            }
        }
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     MenuPetugas menu = new MenuPetugas();
     menu.ShowDialog();
     this.Close();
 }