Ejemplo n.º 1
0
        public static void modifier(Ville uneVille)
        {
            try
            {
                Connexion    uneConnexion = new Connexion();
                MySqlCommand maCommande;

                uneConnexion.getConnexion().Open();
                maCommande = new MySqlCommand("UPDATE parent SET nom = '" + uneVille.getlibelle() + "', code_postal = '" + uneVille.getCodePostal() + " WHERE id = " + uneVille.getID() + ";", uneConnexion.getConnexion());
                maCommande.ExecuteReader();
                uneConnexion.getConnexion().Close();
            }
            catch (MySqlException erreur)
            {
                throw erreur;
            }
        }
Ejemplo n.º 2
0
        public static void ajout(Ville uneVille)
        {
            try
            {
                Connexion    uneConnexion = new Connexion();
                MySqlCommand maCommande;

                uneConnexion.getConnexion().Open();
                maCommande = new MySqlCommand("INSERT INTO ville (id, nom, code_postal) VALUES (" + uneVille.getID() + ", '" + uneVille.getlibelle() + "', '" + uneVille.getCodePostal() + ");", uneConnexion.getConnexion());
                maCommande.ExecuteReader();
                uneConnexion.getConnexion().Close();
            }
            catch (MySqlException erreur)
            {
                throw erreur;
            }
        }