private void btn_hapus_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Anda Yakin Menghapus Data ini ??? ", "Warning !!!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { query = "delete from siswa where no_induk = '" +txt_no_induk.Text+ "'"; koneksi = new Konektor(); byte res = (byte)koneksi.ManipulasiData(query); if (res == 1) { MessageBox.Show("Berhasil Menghapus Data !!!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); AddSiswa_Load(null, null); } else { MessageBox.Show("Gagal Menghapus Data !!!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void vistaButton3_Click(object sender, EventArgs e) { try { koneksi = new Konektor(); if (dataGridView1.Rows.Count > 0) { for (short i = 0; i < dataGridView1.Rows.Count; i++) { query = "insert into siswa values ('" + dataGridView1[0, i].Value.ToString() + "'," + "'" + dataGridView1[1, i].Value.ToString() + "'," + "'" + dataGridView1[2, i].Value.ToString() + "'," + "'" + dataGridView1[3, i].Value.ToString() + "'," + "'" + dataGridView1[4, i].Value.ToString() + "'," + "'" + dataGridView1[5, i].Value.ToString() + "');"; koneksi.ManipulasiData(query); } MessageBox.Show("Berhasil Menyimpan Data !!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Clear(); dataGridView1.DataSource = null; } else { MessageBox.Show("Tidak ada data yang akan disimpan !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_hapus_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Anda Yakin Menghapus Data ini ??? ", "Warning !!!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { query = "delete from siswa where no_induk = '" + txt_no_induk.Text + "'"; koneksi = new Konektor(); byte res = (byte)koneksi.ManipulasiData(query); if (res == 1) { MessageBox.Show("Berhasil Menghapus Data !!!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); AddSiswa_Load(null, null); } else { MessageBox.Show("Gagal Menghapus Data !!!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_hapus_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Anda Yakin Menghapus Data ini ??? ", "Warning !!!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { query = "delete from classes where kelas = '" + dataGridView1[0,dataGridView1.CurrentRow.Index].Value.ToString() + "'"; koneksi = new Konektor(); byte res = (byte)koneksi.ManipulasiData(query); if (res == 1) { MessageBox.Show("Berhasil Menghapus Data !!!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); Kelas_Load(null, null); } else { MessageBox.Show("Gagal Menghapus Data !!!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_hapus_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Anda Yakin Menghapus Data ini ??? ", "Warning !!!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { query = "delete from classes where kelas = '" + dataGridView1[0, dataGridView1.CurrentRow.Index].Value.ToString() + "'"; koneksi = new Konektor(); byte res = (byte)koneksi.ManipulasiData(query); if (res == 1) { MessageBox.Show("Berhasil Menghapus Data !!!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); Kelas_Load(null, null); } else { MessageBox.Show("Gagal Menghapus Data !!!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void vistaButton1_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Anda Yakin Menghapus Semua Data ??? \nData akan hilang semua", "Warning !!!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { query = "delete from siswa"; koneksi = new Konektor(); byte res = (byte)koneksi.ManipulasiData(query); if (res == 1) { MessageBox.Show("Berhasil Menghapus Data !!!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); } AddSiswa_Load(null, null); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_delete_all_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Anda Yakin Menghapus Semua Data ??? \nData akan hilang semua", "Warning !!!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { query = "delete from classes"; koneksi = new Konektor(); byte res = (byte)koneksi.ManipulasiData(query); if (res == 1) { MessageBox.Show("Berhasil Menghapus Data !!!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); } Kelas_Load(null, null); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_ubah_Click(object sender, EventArgs e) { try { query = "update siswa set nama='" + txt_nama.Text + "',alamat='" + txt_alamat.Text + "',kelas='" + comboBox1.Text + "',nama_wali='" + txt_namawali.Text + "',no_hp='" + txt_hp.Text + "' where no_induk='" + txt_no_induk.Text + "'"; byte res = (byte)koneksi.ManipulasiData(query); if (res == 1) { MessageBox.Show("Berhasil mengubah data !!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Gagal mengubah data !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } AddSiswa_Load(null, null); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_ubah_Click(object sender, EventArgs e) { try { query = "update guru set nama_guru='" + txt_namaGuru.Text + "',alamat='" + txt_Alamat.Text + "',jabatan='" + txt_jabatan.Text + "',no_hp='" + txt_hp.Text + "' where no_guru='" + txt_kodeguru.Text + "'"; byte res = (byte)koneksi.ManipulasiData(query); if (res == 1) { MessageBox.Show("Berhasil mengubah data !!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Gagal mengubah data !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } Guru_Load(null, null); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void vistaButton2_Click(object sender, EventArgs e) { try { koneksi = new Konektor(); if (txt_no_induk.Text == "" || txt_nama.Text == "" || txt_namawali.Text == "" || txt_hp.Text == "") { MessageBox.Show("Mohon Lengkapi Data Dulu !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning); txt_no_induk.Focus(); } else { ds = new DataSet(); ds = koneksi.GetData("select * from siswa where no_induk = '" + txt_no_induk.Text + "'"); if (ds.Tables[0].Rows.Count == 0) { query = "insert into siswa values ('" + txt_no_induk.Text + "','" + txt_nama.Text + "','" + txt_alamat.Text + "','" + comboBox1.Text + "','" + txt_namawali.Text + "','" + txt_hp.Text + "');"; byte res = (byte)koneksi.ManipulasiData(query); if (res == 1) { MessageBox.Show("Berhasil menambah data !!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); } AddSiswa_Load(null, null); } else { MessageBox.Show("No Induk sudah terpakai", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); txt_no_induk.Clear(); txt_no_induk.Focus(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_simpan_Click(object sender, EventArgs e) { try { koneksi = new Konektor(); if (txt_kodeguru.Text == "" || txt_namaGuru.Text == "" || txt_Alamat.Text == "" || txt_hp.Text == "") { MessageBox.Show("Mohon Lengkapi Data Dulu !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning); txt_kodeguru.Focus(); } else { ds = new DataSet(); ds = koneksi.GetData("select * from guru where no_guru = '" + txt_kodeguru.Text + "'"); if (ds.Tables[0].Rows.Count == 0) { query = "insert into guru values ('" + txt_kodeguru.Text + "','" + txt_namaGuru.Text + "','" + txt_Alamat.Text + "','" + txt_hp.Text + "','" + txt_jabatan.Text + "');"; byte res = (byte)koneksi.ManipulasiData(query); if (res == 1) { MessageBox.Show("Berhasil menambah data !!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); } Guru_Load(null, null); } else { MessageBox.Show("No Induk sudah terpakai", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); txt_kodeguru.Clear(); txt_kodeguru.Focus(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_simpan_Click(object sender, EventArgs e) { try { if (textBox1.Text != "") { koneksi = new Konektor(); ds = new DataSet(); query = "select * from classes where kelas = '" + textBox1.Text + "';"; ds = koneksi.GetData(query); if (ds.Tables[0].Rows.Count == 0) { query = "insert into Classes values ('" + textBox1.Text + "');"; byte res = (byte)koneksi.ManipulasiData(query); if (res == 1) { MessageBox.Show("Berhasil menambah data"); } } else { MessageBox.Show("Kelas sudah terdaftar !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Mohon Lengkapi Data Dulu !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } Kelas_Load(null, null); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void vistaButton3_Click(object sender, EventArgs e) { try { koneksi = new Konektor(); if (dataGridView1.Rows.Count > 0) { for (short i = 0; i < dataGridView1.Rows.Count; i++) { query = "insert into siswa values ('"+dataGridView1[0,i].Value.ToString()+"',"+ "'" + dataGridView1[1, i].Value.ToString() + "',"+ "'" + dataGridView1[2, i].Value.ToString() + "',"+ "'" + dataGridView1[3, i].Value.ToString() + "',"+ "'" + dataGridView1[4, i].Value.ToString() + "',"+ "'" + dataGridView1[5, i].Value.ToString() + "');"; koneksi.ManipulasiData(query); } MessageBox.Show("Berhasil Menyimpan Data !!","Informasi",MessageBoxButtons.OK,MessageBoxIcon.Information); textBox1.Clear(); dataGridView1.DataSource = null; } else { MessageBox.Show("Tidak ada data yang akan disimpan !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void vistaButton2_Click(object sender, EventArgs e) { try { koneksi = new Konektor(); if (txt_no_induk.Text == "" || txt_nama.Text == "" || txt_namawali.Text == "" || txt_hp.Text == "") { MessageBox.Show("Mohon Lengkapi Data Dulu !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning); txt_no_induk.Focus(); } else { ds = new DataSet(); ds = koneksi.GetData("select * from siswa where no_induk = '"+txt_no_induk.Text+"'"); if (ds.Tables[0].Rows.Count == 0) { query = "insert into siswa values ('" + txt_no_induk.Text + "','" + txt_nama.Text + "','" + txt_alamat.Text + "','" + comboBox1.Text + "','" + txt_namawali.Text + "','" + txt_hp.Text + "');"; byte res = (byte)koneksi.ManipulasiData(query); if (res == 1) { MessageBox.Show("Berhasil menambah data !!", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); } AddSiswa_Load(null, null); } else { MessageBox.Show("No Induk sudah terpakai","Warning",MessageBoxButtons.OK,MessageBoxIcon.Warning); txt_no_induk.Clear(); txt_no_induk.Focus(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_simpan_Click(object sender, EventArgs e) { try { if (textBox1.Text != "") { koneksi = new Konektor(); ds = new DataSet(); query = "select * from classes where kelas = '"+textBox1.Text+"';"; ds = koneksi.GetData(query); if (ds.Tables[0].Rows.Count == 0) { query = "insert into Classes values ('" + textBox1.Text + "');"; byte res = (byte)koneksi.ManipulasiData(query); if (res == 1) { MessageBox.Show("Berhasil menambah data"); } } else { MessageBox.Show("Kelas sudah terdaftar !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Mohon Lengkapi Data Dulu !!", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } Kelas_Load(null, null); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }