コード例 #1
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     seting           = new Seting(nis);
     seting.BackColor = this.BackColor;
     seting.Show();
     this.Hide();
 }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            seting = new Seting();
            Loginpage frm1 = new Loginpage();

            koneksi();

            //ganti back Color seting
            seting.BackColor = this.BackColor;
            seting.Show();
            this.Hide();

            String       s      = "SELECT nis FROM student WHERE email = '" + frm1.getemail() + "'";
            MySqlCommand c      = new MySqlCommand(s, conn);
            Object       result = c.ExecuteScalar();
            String       nis1   = (String)result;

            String sql = "";

            if (BackColor == Color.FromArgb(238, 142, 160))
            {
                sql = "UPDATE student SET Theme = 1 WHERE NIS = '" + nis1 + "'";
            }
            else if (BackColor == Color.FromArgb(249, 157, 42))
            {
                sql = "UPDATE student SET Theme = 2 WHERE NIS = '" + nis1 + "'";
            }
            else if (BackColor == Color.FromArgb(224, 43, 48))
            {
                sql = "UPDATE student SET Theme = 3 WHERE NIS = '" + nis1 + "'";
            }
            else if (BackColor == Color.FromArgb(95, 189, 102))
            {
                sql = "UPDATE student SET Theme = 4 WHERE NIS = '" + nis1 + "'";
            }
            else if (BackColor == Color.FromArgb(0, 192, 192))
            {
                sql = "UPDATE student SET Theme = 5 WHERE NIS = '" + nis1 + "'";
            }
            MySqlCommand cmd = new MySqlCommand(sql, conn);

            cmd.ExecuteNonQuery();
            conn.Close();
        }