示例#1
0
 public static void create(Profil profil)
 {
     try
     {
         open();
         MySqlCommand cmd = new MySqlCommand();
         cmd.Connection  = conn;
         cmd.CommandText = "INSERT INTO profils(nom, prenom, email, telephone, pseudo, mdp) VALUES(@nom, @prenom, @email, @telephone, @pseudo, @mdp)";
         cmd.Prepare();
         cmd.Parameters.AddWithValue("@nom", profil.Get_nom());
         cmd.Parameters.AddWithValue("@prenom", profil.Get_prenom());
         cmd.Parameters.AddWithValue("@email", profil.Get_email());
         cmd.Parameters.AddWithValue("@telephone", profil.Get_telephone());
         cmd.Parameters.AddWithValue("@pseudo", profil.Get_pseudo());
         cmd.Parameters.AddWithValue("@mdp", profil.Get_mdp());
         cmd.ExecuteNonQuery();
         Console.WriteLine("profil créé");
         close();
     }
     catch (MySqlException ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
示例#2
0
 public void Set_profil(Profil pro)
 {
     this.profil = pro;
 }