public Boolean insertVendor(EntVendor ev) { status = false; try { koneksi.Open(); query = "INSERT INTO vendor (nama_vendor,alamat_vendor,telp,email,website) VALUES ('" + ev.getNamaVendor() + "' , '" + ev.getAlamatVendor() + "' , '" + ev.getTelp() + "' , '" + ev.getEmail() + "' , '" + ev.getWebsite() + "')"; MySqlCommand command = koneksi.CreateCommand(); command.CommandText = query; command.ExecuteNonQuery(); status = true; koneksi.Close(); } catch (MySqlException me) { Console.WriteLine(me); } return(status); }
public Boolean updateVendor(EntVendor ev, int id_vendor) { status = false; try { koneksi.Open(); query = "UPDATE vendor SET nama_vendor ='" + ev.getNamaVendor() + "', alamat_vendor ='" + ev.getAlamatVendor() + "', telp ='" + ev.getTelp() + "', email ='" + ev.getEmail() + "', website ='" + ev.getWebsite() + "' WHERE id_vendor =" + id_vendor + ""; MySqlCommand command = koneksi.CreateCommand(); command.CommandText = query; command.ExecuteNonQuery(); status = true; koneksi.Close(); } catch (MySqlException me) { Console.WriteLine(me); } return(status); }