//Insert Data public Boolean insertPekerjaan(Entity.EntPekerjaan e) { status = false; try { query = "INSERT INTO tb_pekerjaan VALUES ('" + e.getKode() + e.getNama() + e.getKeterangan() + "')"; koneksi.Open(); command = new MySqlCommand(); command.Connection = koneksi; command.CommandText = query; command.ExecuteNonQuery(); status = true; koneksi.Close(); } catch (MySqlException) { Console.WriteLine("ERROR!!!"); } return(status); }
//Update Pekerjaan public Boolean updatePekerjaan(Entity.EntPekerjaan e) { status = false; try { query = "UPDATE tb_pekerjaan SET nama='" + e.getNama() + "', keterangan='" + e.getKeterangan() + "', WHERE id_kerja='" + e.getKode() + "'"; koneksi.Open(); command = new MySqlCommand(); command.Connection = koneksi; command.CommandText = query; command.ExecuteNonQuery(); status = true; koneksi.Close(); } catch (MySqlException) { Console.WriteLine("ERROR!!!"); } return(status); }