//Submit Data public Boolean submitCalon(Entity.EntCalon e) { status = false; try { query = "INSERT INTO tb_calon VALUES ('" + e.getNomor() + "','" + e.getNama() + "','" + e.getPartai() + "')"; koneksi.Open(); SqlCommand command = koneksi.CreateCommand(); command.CommandText = query; command.ExecuteNonQuery(); status = true; koneksi.Close(); } catch (SqlException ex) { Console.WriteLine("ERROR" + ex.Message); } return(status); }
public Boolean updateCalon(Entity.EntCalon e) { status = false; try { query = "UPDATE tb_calon SET nama_calon = '" + e.getNama() + "', partai_calon = '" + e.getPartai() + "'" + "' WHERE id_staff = '" + e.getNomor() + "' is not null"; koneksi.Open(); SqlCommand command = koneksi.CreateCommand(); command.CommandText = query; command.ExecuteNonQuery(); status = true; koneksi.Close(); } catch (SqlException ex) { Console.WriteLine("ERROR" + ex.Message); } return(status); }