public Boolean update(Object o1, Object o2) { try { Organisateur or = (Organisateur)o1; Agence_Voyage av = (Agence_Voyage)o2; int id = or.id; String nom = or.nom_organisateur; String email = or.email; String adresse = or.adresse; String description = av.description; Pl_SQL plsql = new Pl_SQL(); string req = string.Format(plsql.ModifierAgence(id, nom, email, adresse, description)); cmd.Connection = cn; cn.Open(); cmd.CommandText = req; cmd.ExecuteNonQuery(); return(true); } catch (OleDbException ex) { System.Console.WriteLine("error :" + ex.Message); return(false); } finally { cn.Close(); } }
public void AjouterAgence_Voyage(int id, String description) { av = new Agence_Voyage(id, description); Boolean test = avDA.insert(av); if (test == true) { MessageBox.Show("L'ajout effectué avec succes", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Erreur de l'insertion", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public Boolean insert(Object o) { try { Agence_Voyage ag = (Agence_Voyage)o; int id = ag.id; String description = ag.description; string req = string.Format("insert into Agence_Voyage values (" + id + ",'" + description + "')"); cmd.Connection = cn; cn.Open(); cmd.CommandText = req; cmd.ExecuteNonQuery(); return(true); } catch (OleDbException ex) { System.Console.WriteLine("error :" + ex.Message); return(false); } finally { cn.Close(); } }