Bonjour à tous,
j'ai un petit probleme avec mes boucles if !!!
le code suivant ne recherche pas la valeur dans la base. Si je retire l'une des deux boucles de recherche cela fonctionne .....
quelqu'un aurait un ptite idée de ce qui se passe ?
MErci d'avance pour votre aide
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97 <table id="resultab"> <tr class="textebleu"> <td width="58">frfr </td> <td width="58"> vfdvdf</td> <td width="58"> dfvd</td> <td width="58"> dfvd</td> <td width="58"> df</td> <td width="58"> dfv</td> <td width="58"> fdv</td> <td width="58"> dfv</td> <td width="58"> dfvdf</td> <td width="58"> cxvx</td> <td width="58"> lio</td> <td width="58"> bvc</td> </tr> <% 'Dans la même page nommé mapage.asp à la suite du formulaire if request("ok") = "Fef" then Recordset1__MMColParam = Request("trouvertexte") response.write ("essai") 'Connexion à la BD : DSN_BASE = "DBQ=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "bdd\fef.mdb" & ";Driver={Microsoft Access Driver (*.mdb)};Driverld=25" 'Creation du recordset Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open DSN_BASE Set RS = Server.CreateObject("ADODB.Recordset") 'Requete sql Sql="SELECT * FROM Produits WHERE Marque LIKE '%"& Replace(Recordset1__MMColParam, "'", "''") &"%'" Rs.open Sql, conn end if if request("ok") = "Rubrique" then Recordset1__MMColParam = Request("rubrique") 'Connexion à la BD : DSN_BASE = "DBQ=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "bdd\fef.mdb" & ";Driver={Microsoft Access Driver (*.mdb)};Driverld=25" 'Creation du recordset Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open DSN_BASE Set RS = Server.CreateObject("ADODB.Recordset") 'Requete sql Sql="SELECT * FROM Produits WHERE Catégorie LIKE '%"& Replace(Recordset1__MMColParam, "'", "''") &"%'" Rs.open Sql, conn if rs.eof then 'si il n'y a pas d'enregistrement répondant à la requete alors : Response.write "Aucun résultat correspondant à votre recherche" else 'si résultat trouver on affiche tous les résultats, on n'est pas censé savoir cb d'enregistrement il existe dans la table do while not rs.eof %> <tr class="textebleu"> <td colspan="4"><img src="image/resulbleu256px1px.jpg" width="256" height="1"></td> <td colspan="4"> </td> <td colspan="4"><img src="image/resulrouge256px1px.jpg" width="256" height="1"></td> </tr> <tr class="textebleu"> <td width="58"> <% response.write rs(2) &vbcrlf %> </td> <td width="58"><% response.write rs(3) &vbcrlf %> </td> <td width="58"><% response.write rs(4) &vbcrlf %> </td> <td width="58"><% response.write rs(5) &vbcrlf %> </td> <td width="58"><% response.write rs(6) &vbcrlf %> </td> <td width="58"><% response.write rs(7) &vbcrlf %> </td> <td width="58"><% response.write rs(8) &vbcrlf %> </td> <td width="58"><% response.write rs(9) &vbcrlf %> </td> <td width="58"><% response.write rs(10) &vbcrlf %> </td> <td width="58"><% response.write rs(11) &vbcrlf %> </td> <td width="58"><% response.write rs(12) &vbcrlf %> </td> <td width="58"><% response.write rs(13) &vbcrlf %> </td> </tr> <% rs.movenext loop end if Set RS = Nothing Conn.Close Set Conn = Nothing end if %> </table>
Partager