public frmPaket() { koneksi = KoneksiDB.Koneksi.getKoneksi(); impPaket = new ImpPaket(); impVendor = new ImpVendor(); entPaket = new EntPaket(); InitializeComponent(); cmbVendor(); CmbViewVendor.Focus(); }
public Boolean updatePaket(EntPaket ep, int id_paket) { status = false; try { koneksi.Open(); query = "UPDATE paket SET id_vendor ='" + ep.getIDVendor() + "', nama_paket ='" + ep.getNamaPaket() + "', harga =" + ep.getHarga() + " WHERE id_paket=" + id_paket + ""; MySqlCommand command = koneksi.CreateCommand(); command.CommandText = query; command.ExecuteNonQuery(); status = true; koneksi.Close(); } catch (MySqlException me) { Console.WriteLine(me); } return(status); }
public Boolean insertPaket(EntPaket ep) { status = false; try { koneksi.Open(); query = "INSERT INTO paket (id_vendor,nama_paket,harga) VALUES ('" + ep.getIDVendor() + "' ,'" + ep.getNamaPaket() + "' , " + ep.getHarga() + ")"; MySqlCommand command = koneksi.CreateCommand(); command.CommandText = query; command.ExecuteNonQuery(); status = true; koneksi.Close(); } catch (MySqlException me) { Console.WriteLine(me); } return(status); }