コード例 #1
0
        public DataTable baca()
        {
            koneksi   conn = new koneksi();
            string    sql  = "select  * from siswa where nis='" + this.textBox16.Text + "'";
            DataTable dt   = new DataTable();

            try
            {
                conn.tampil();
                MySqlCommand     cmd = new MySqlCommand(sql, conn.konek);
                MySqlDataAdapter adp = new MySqlDataAdapter(cmd);

                cmd.ExecuteNonQuery();
                adp.Fill(dt);
                bindingSource1.DataSource       = dt;
                dataGridView1.DataSource        = bindingSource1;
                bindingNavigator1.BindingSource = bindingSource1;
            }
            catch (Exception luk)
            {
                MessageBox.Show(luk.Message);
            }
            conn.tutup();
            return(dt);
        }
コード例 #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     try {
         koneksi conn = new koneksi();
         conn.tampil();
         conn.QUERY("insert into siswa (nis,nama,alamat,jenkel,kelas,kek_thn_lalu,daftar_ulang,spp1,spp2,spp3,sardik,lks,lainlain1,lainlain2,jumlah,keterangan) values ('" + this.textBox1.Text + "','" + this.textBox2.Text + "','" + this.textBox3.Text + "','" + this.textBox4.Text +
                    "','" + this.comboBox3.Text + "','" + this.textBox5.Text + "','" + this.textBox6.Text + "','" + this.comboBox1.Text + "','" + this.comboBox2.Text + "','" + this.textBox7.Text + "','" + this.textBox8.Text + "','" + this.textBox9.Text + "','" + this.textBox10.Text +
                    "','" + this.textBox11.Text + "','" + this.textBox12.Text + "','" + this.dateTimePicker1.Text + "')");
     }
     catch (Exception luki)
     {
         MessageBox.Show(luki.Message);
     }
 }
コード例 #3
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         koneksi conn = new koneksi();
         conn.tampil();
         conn.QUERY("update siswa set nama='" + this.textBox2.Text + "',alamat='" + textBox3.Text + "',jenkel='" + textBox4.Text + "',kelas='" + textBox5.Text + "',kek_thn_lalu='" + kekurangan2.Text + "',daftar_ulang='" + d_ulang2.Text + "',spp1='" + comboBox1.Text + "',spp2='" + comboBox2.Text + "',spp3='" + spp2.Text +
                    "',sardik='" + sardik2.Text + "',lks='" + lks2.Text + "',lainlain1='" + textBox22.Text + "',lainlain2='" + lainlain2.Text + "',jumlah='" + jumlah.Text + "',keterangan='" + dateTimePicker1.Text + "'where nis='" + textBox1.Text + "'");
     }
     catch (Exception les)
     {
         MessageBox.Show(les.Message);
     }
 }
コード例 #4
0
        public DataTable baca()
        {
            koneksi   conn = new koneksi();
            string    sql  = "select * from siswa";
            DataTable dt   = new DataTable();

            try
            {
                conn.tampil();
                MySqlCommand     cmd = new MySqlCommand(sql, conn.konek);
                MySqlDataAdapter adp = new MySqlDataAdapter(cmd);
                cmd.ExecuteNonQuery();
                adp.Fill(dt);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            conn.tutup();
            return(dt);
        }
コード例 #5
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult di = MessageBox.Show("Edit Data?", "important", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
         if (di == DialogResult.Yes)
         {
             koneksi conn = new koneksi();
             conn.tampil();
             conn.QUERY("update siswa set nama='" + this.textBox2.Text + "',alamat='" + textBox3.Text + "',jenkel='" + textBox4.Text + "',kelas='" + comboBox3.Text + "',kek_thn_lalu='" + textBox5.Text + "',daftar_ulang='" + textBox6.Text + "',spp1='" + comboBox1.Text + "',spp2='" + comboBox2.Text + "',spp3='" + textBox7.Text + "',sardik='" + textBox8.Text + "',lks='" + textBox9.Text + "',lainlain1='" + textBox10.Text +
                        "',lainlain2='" + textBox11.Text + "',jumlah='" + textBox12.Text + "',keterangan='" + dateTimePicker1.Text + "'where nis='" + textBox1.Text + "'");
             conn.tutup();
         }
         else if (di == DialogResult.No)
         {
         }
     }
     catch (Exception kur)
     {
         MessageBox.Show(kur.Message);
     }
 }
コード例 #6
0
        private void button6_Click(object sender, EventArgs e)
        {
            DialogResult di = MessageBox.Show("Hapus Data?", "important", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

            if (di == DialogResult.Yes)
            {
                try
                {
                    koneksi conn = new koneksi();
                    conn.tampil();
                    conn.QUERY("delete from siswa where nis='" + this.textBox14.Text + "'");

                    MessageBox.Show("DIHAPUS");
                    conn.tutup();
                }
                catch (Exception lul)
                {
                    MessageBox.Show(lul.Message);
                }
            }
            else if (di == DialogResult.No)
            {
            }
        }