예제 #1
0
 private void ajouter_Click(object sender, EventArgs e)
 {
     if (Validation.VerificationTexte(nom.Text) && Validation.VerificationTexte(prenom.Text) && Validation.VerificationEmail(email.Text) &&
         Validation.VerificationTelephone(telephone.Text) && Validation.VerificationTexte(adresse.Text))
     {
         MySqlCommand commandDB = new MySqlCommand("insert into Client (nomc, prenomc, emailc, telephonec, adressec) values ( '" + nom.Text + "','" + prenom.Text + "','" + email.Text + "','" + telephone.Text + "','" + adresse.Text + "')", databaseConnection);
         try
         {
             databaseConnection.Open();
             MySqlDataReader myReader = commandDB.ExecuteReader();
             MessageBox.Show("Le Client a été ajouté avec succès ! ");
         }
         catch (Exception excep)
         {
             MessageBox.Show("Erreur Vérifier Votre code SQL " + excep.Message);
         }
     }
 }