public void MettreAJour() { string sql; sql = "UPDATE table_valeur SET"; sql += " nom ='" + Nom.Replace("'", "''") + "',"; sql += " code ='" + Code + "',"; sql += " valeur ='" + Valeur.Replace("'", "''") + "',"; sql += " valeur_6po ='" + Valeur6PO.Replace("'", "''") + "'"; sql += " WHERE id='" + ID + "'"; Acces.cls.Execute(sql); }
public void Ajouter() { string sql; sql = "INSERT INTO table_valeur (nom, code, valeur, valeur_6po) VALUES ("; sql += "'" + Nom.Replace("'", "''") + "',"; sql += "'" + Code + "',"; sql += "'" + Valeur.Replace("'", "''") + "',"; sql += "'" + Valeur6PO.Replace("'", "''") + "')"; Acces.cls.Execute(sql); //Recherche de l'iD attribué sql = "SELECT id from table_valeur"; sql += " WHERE nom='" + Nom.Replace("'", "''") + "'"; sql += " AND code='" + Code + "'"; DataSet Sn = Acces.cls.ContenuRequete(sql); if (Acces.cls.NbLignes > 0) { ID = int.Parse(Sn.Tables["dataset"].Rows[0][0].ToString()); } }