private void button5_Click_1(object sender, EventArgs e)
        {
            koneksi();
            String       sq     = "SELECT ID_Course FROM course WHERE Course_Name = '" + cName.Text + "'";
            MySqlCommand cm     = new MySqlCommand(sq, conn);
            Object       result = cm.ExecuteScalar();
            int          id     = (int)result;

            String       q        = "SELECT ID_Schedule FROM schedule WHERE course = '" + cName.Text + "'";
            MySqlCommand d        = new MySqlCommand(q, conn);
            Object       r        = d.ExecuteScalar();
            int          id_sched = (int)r;

            String       s = "UPDATE course SET Course_Name = '" + cName.Text + "' WHERE ID_Course = " + id;
            MySqlCommand c = new MySqlCommand(s, conn);

            c.ExecuteNonQuery();

            String       sql = "UPDATE schedule SET Day = '" + textBox1.Text + "', Room = '" + cls.Text + "', Course = '" + cName.Text + "', Teacher = '" + teache.Text + "', Time = '" + hour + ":" + minute + "' WHERE ID_Schedule = " + id_sched;
            MySqlCommand cmd = new MySqlCommand(sql, conn);

            cmd.ExecuteNonQuery();
            conn.Close();
            sched = new ScheduleTeacher(NIK);
            sched.Show();
            sched.BackColor = this.BackColor;
            this.Hide();
        }
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     sched = new ScheduleTeacher(NIP);
     sched.Show();
     sched.BackColor = this.BackColor;
     this.Hide();
 }
        private void delete_Click(object sender, EventArgs e)
        {
            DialogResult box = MessageBox.Show("Are you sure want to delete the schedule?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (box == DialogResult.Yes)
            {
                koneksi();
                String       sq     = "SELECT ID_Course FROM course WHERE Course_Name = '" + cName.Text + "'";
                MySqlCommand cm     = new MySqlCommand(sq, conn);
                Object       result = cm.ExecuteScalar();
                int          id     = (int)result;

                String       q        = "SELECT ID_Schedule FROM schedule WHERE course = '" + cName.Text + "'";
                MySqlCommand d        = new MySqlCommand(q, conn);
                Object       r        = d.ExecuteScalar();
                int          id_sched = (int)r;

                String       s = "DELETE FROM course WHERE ID_Course = " + id;
                MySqlCommand c = new MySqlCommand(s, conn);
                c.ExecuteNonQuery();

                String       sql = "DELETE FROM schedule WHERE ID_Schedule = " + id_sched;
                MySqlCommand cmd = new MySqlCommand(sql, conn);
                cmd.ExecuteNonQuery();
                conn.Close();
                sched = new ScheduleTeacher(NIK);
                sched.Show();
                sched.BackColor = this.BackColor;
                this.Hide();
            }
            else if (box == DialogResult.No)
            {
                this.Show();
            }
        }
        private void button5_Click(object sender, EventArgs e)
        {
            koneksi();
            String       s = "INSERT INTO course (Course_Name) values ('" + textBox1.Text + "')";
            MySqlCommand c = new MySqlCommand(s, conn);

            c.ExecuteNonQuery();

            String       sq     = "SELECT max(ID_Course) FROM course";
            MySqlCommand cm     = new MySqlCommand(sq, conn);
            Object       result = cm.ExecuteScalar();
            int          id     = (int)result;

            String       sql = "INSERT INTO schedule (Day, Time, Room, Course, Teacher, NIK, ID_Course) values ('" + textBox2.Text + "','" + hour + ":" + minute + "','" + textBox7.Text + "','" + textBox1.Text + "','" + textBox4.Text + "','" + NIP + "'," + id + ")";
            MySqlCommand cmd = new MySqlCommand(sql, conn);

            cmd.ExecuteNonQuery();
            conn.Close();
            sched = new ScheduleTeacher(NIP);
            sched.Show();
            sched.BackColor = this.BackColor;
            this.Hide();
        }