public static void Insert(Facture f) { Program.DbConnection.Open(); string strsql = "INSERT INTO Facture VALUES (?,?)"; OleDbCommand cmd = new OleDbCommand(strsql, Program.DbConnection); OleDbParameter p1 = new OleDbParameter("pref", OleDbType.Integer); OleDbParameter p2 = new OleDbParameter("pdate", OleDbType.Date); p1.Value = f.Ref; p2.Value = f.DateFacture; cmd.Parameters.Add(p1); cmd.Parameters.Add(p2); int x = cmd.ExecuteNonQuery(); if (x < 1) MessageBox.Show("Echec : [AJOUT].", "FACTURE", MessageBoxButton.OK); Program.DbConnection.Close(); }
private void BtnValider_Click(object sender, EventArgs e) { if (Validator()) { Facture F = new Facture(int.Parse(RefFac.Text),DateFac.Value); if (0 == AddDatilFacture()) { Facture.Insert(F); MessageBox.Show("C bon"); } else MessageBox.Show("Laaaaaa matnajemch tzid ,famma chkoun badel l base :p"); } }