private void ChargementCollectionAdmin() { try { CollAdmin.Clear(); //Ouverture connexion GestConn.Open(); //Requete SQL String ReqSql = "SELECT * FROM membre ORDER BY ID_MEMBRE"; MySqlCommand MaCommande = new MySqlCommand(ReqSql, GestConn); //Déclaration de Data Reader MySqlDataReader ReaderAdmin; //Exécution de la requête ReaderAdmin = MaCommande.ExecuteReader(); //Nouveau contact Admin NouveauAdmin; while (ReaderAdmin.Read()) { NouveauAdmin.id = int.Parse(ReaderAdmin["ID_MEMBRE"].ToString()); NouveauAdmin.nom = (ReaderAdmin["NOM_MEMBRE"].ToString()); NouveauAdmin.prenom = (ReaderAdmin["PRENOM_MEMBRE"].ToString()); NouveauAdmin.mail = (ReaderAdmin["EMAIL_MEMBRE"].ToString()); NouveauAdmin.ville = (ReaderAdmin["VILLE_MEMBRE"].ToString()); NouveauAdmin.adresse = (ReaderAdmin["ADRESSE_MEMBRE"].ToString()); NouveauAdmin.cp = (ReaderAdmin["CP_MEMBRE"].ToString()); NouveauAdmin.telephone = (ReaderAdmin["TEL_MEMBRE"].ToString()); NouveauAdmin.mdp = (ReaderAdmin["MDP_MEMBRE"].ToString()); NouveauAdmin.login = (ReaderAdmin["LOGIN_MEMBRE"].ToString()); NouveauAdmin.type = (ReaderAdmin["TYPE_MEMBRE"].ToString()); NouveauAdmin.photo = (ReaderAdmin["PHOTO_MEMBRE"].ToString()); NouveauAdmin.desc = (ReaderAdmin["DESC_MEMBRE"].ToString()); NouveauAdmin.valide = int.Parse(ReaderAdmin["VALIDE_MEMBRE"].ToString()); NouveauAdmin.argent = Convert.ToDouble(ReaderAdmin["ARGENT_MEMBRE"].ToString()); CollAdmin.Add(NouveauAdmin); } ReaderAdmin.Close(); GestConn.Close(); } catch (Exception ex) { MessageBox.Show("Erreur : " + ex.Message); } }
public void rechercheInformation(String requeteSQL) { try { //Ouverture connexion GestConn.Open(); MySqlCommand MaCommande = new MySqlCommand(requeteSQL, GestConn); //Déclaration de Data Reader MySqlDataReader ReaderAdmin; //Exécution de la requête ReaderAdmin = MaCommande.ExecuteReader(); while (ReaderAdmin.Read()) { this.nom = (ReaderAdmin["NOM_MEMBRE"].ToString()); this.prenom = (ReaderAdmin["PRENOM_MEMBRE"].ToString()); this.mail = (ReaderAdmin["EMAIL_MEMBRE"].ToString()); this.ville = (ReaderAdmin["VILLE_MEMBRE"].ToString()); this.adresse = (ReaderAdmin["ADRESSE_MEMBRE"].ToString()); this.cp = (ReaderAdmin["CP_MEMBRE"].ToString()); this.telephone = (ReaderAdmin["TEL_MEMBRE"].ToString()); this.mdp = (ReaderAdmin["MDP_MEMBRE"].ToString()); this.login = (ReaderAdmin["LOGIN_MEMBRE"].ToString()); this.type = (ReaderAdmin["TYPE_MEMBRE"].ToString()); this.photo = (ReaderAdmin["PHOTO_MEMBRE"].ToString()); this.desc = (ReaderAdmin["DESC_MEMBRE"].ToString()); this.valide = int.Parse(ReaderAdmin["VALIDE_MEMBRE"].ToString()); this.argent = Convert.ToDouble(ReaderAdmin["ARGENT_MEMBRE"].ToString()); } ReaderAdmin.Close(); GestConn.Close(); } catch (Exception ex) { MessageBox.Show("Erreur : " + ex.Message); } }