Bonjour tout le monde c'est sûrement une question bête mais je ne comprends pas pourquoi ma requête " REQUERY" ne se met pas à jour ...?
Pour décrire le code ,
La variable REQUERY représente la fin d'une requête , elle représente ce qu'il y a après le WHERE.
Quand une des combobox est sélectionnées son index et différents de "-1" donc le programme doit ajouter une partie de texte qui me permettre de crée une requête "AND...".
SAUF QUE quelque soit ma sélection il ne prend que le premier if qu'il lit et pas les autres...
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72 string REQUERY = ""; if (CatégorieRadiologique_ComboBox_Home.SelectedIndex != -1) { if (REQUERY != "") { REQUERY += REQUERY + " AND Radiologique =" + "'" + CatégorieRadiologique_ComboBox_Home.Text + "'"; } else { REQUERY += REQUERY + "Radiologique =" + "'" + CatégorieRadiologique_ComboBox_Home.Text + "'"; } } else if (CodeEtatFS_ComboBox_Home.SelectedIndex != -1) { if (REQUERY != "") { REQUERY += REQUERY + " AND Lib_Code_Etat =" + "'" + CodeEtatFS_ComboBox_Home.Text + "'"; } else { REQUERY += REQUERY + "Lib_Code_Etat =" + "'" + CodeEtatFS_ComboBox_Home.Text + "'"; } } else if (Producteur_ComboBox_Home.SelectedIndex != -1) { if (REQUERY != "") { REQUERY += REQUERY + " AND Producteur =" + "'" + Producteur_ComboBox_Home.Text + "'"; } else { REQUERY += REQUERY + "Producteur =" + "'" + Producteur_ComboBox_Home.Text + "'"; } } else if (Centre_ComboBox_Home.SelectedIndex != -1) { if (REQUERY != "") { REQUERY += REQUERY + " AND Centre =" + "'" + Centre_ComboBox_Home.Text + "'"; } else { REQUERY += REQUERY + "Centre =" + "'" + Centre_ComboBox_Home.Text + "'"; } } else if (StationDestination_ComboBox_Home.SelectedIndex != -1) { if (REQUERY != "") { REQUERY += REQUERY + " AND Station_Destination =" + "'" + StationDestination_ComboBox_Home.Text + "'"; } else { REQUERY += REQUERY + "Station_Destination =" + "'" + StationDestination_ComboBox_Home.Text + "'"; } } else if (Conditionnement_ComboBox_Home.SelectedIndex != -1) { if (REQUERY != "") { REQUERY += REQUERY + " AND Conditionnement =" + "'" + Conditionnement_ComboBox_Home.Text + "'"; } else { REQUERY += REQUERY + "Conditionnement =" + "'" + Conditionnement_ComboBox_Home.Text + "'"; } } else REQUERY += " "; MessageBox.Show(REQUERY);
Pouvez vous m'aider?
Partager