Bonjour !!
J'ai créé une application C# et je suis bloqué sur plusieurs points..
Je voudrais que l'application affiche différents profils avec leur nom, poste et compétences
Seulement avec mon code :
j'obtiens :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 private void TrouveUnFreelance_Load(object sender, EventArgs e) { //trackbarDistance.Value = int.Parse(labelDistance.Text); MySqlConnection uneConnexion; MySqlCommand uneRequete; MySqlCommand uneRequete1; MySqlCommand uneRequete2; string connectionString = "Database=trouveunfreelance;Data Source=localhost;User Id=root;Password="; uneConnexion = new MySqlConnection(connectionString); try { uneConnexion.Open(); } catch (Exception ex) { Console.WriteLine("Connexion impossible ! "); } uneRequete = new MySqlCommand("SELECT prenom, nom FROM freelance"); uneRequete.Connection = uneConnexion; MySqlDataReader MonReader = uneRequete.ExecuteReader(); while (MonReader.Read()) { listBoxNom.Items.Add(MonReader.GetString(0) + " " + MonReader.GetString(1)); listBoxNom1.Items.Add(MonReader.GetString(0) + " " + MonReader.GetString(1)); listBoxNom2.Items.Add(MonReader.GetString(0) + " " + MonReader.GetString(1)); listBoxNom3.Items.Add(MonReader.GetString(0) + " " + MonReader.GetString(1)); } uneConnexion = new MySqlConnection(connectionString); uneRequete1 = new MySqlCommand("SELECT poste FROM freelance"); uneRequete1.Connection = uneConnexion; MySqlDataReader MonReader1 = uneRequete1.ExecuteReader(); while (MonReader1.Read()) { listBoxPoste.Items.Add(MonReader1.GetString(0)); } uneConnexion = new MySqlConnection(connectionString); uneRequete2 = new MySqlCommand("SELECT poste FROM freelance"); uneRequete2.Connection = uneConnexion; MySqlDataReader MonReader2 = uneRequete1.ExecuteReader(); while (MonReader2.Read()) { listBoxCompetences.Items.Add(MonReader2.GetString(0)); listBoxCompetences1.Items.Add(MonReader2.GetString(0)); listBoxCompetences2.Items.Add(MonReader2.GetString(0)); listBoxCompetences3.Items.Add(MonReader2.GetString(0)); } }
il faut cliquer sur la flèche du bas pour faire défiler les noms et du coup les postes ne changent pas avec l'Id de la personne ( Id_Freelance) .
De plus, le poste et les compétences ne s'affichent pas,
Avez-vous des solutions ?
Merci et bonne journée !
Partager