Bonjours,
j'utilise un formulaire ASP qui me permet de trier le résultat d'une requête odb. Cela fonctionne mais je ne peut pas accéder deux fois de suite à la base il faut que je patiente quelques minutes avant de pouvoir avoir un résultat je pense que je ne doit pas bien fermer la base... ?
Voici la page formulaire:
<!-- #include file="connexion.asp"-->
<link rel="stylesheet" href="tableaux.css">
<HTML><BODY>
<h3>Bienvenue sur la base jojo</h3>
<%SQL="SELECT distinct type FROM [tarifs]"
Set RS = server.createobject("ADODB.Recordset")
RS.Open SQL,Conn , 3, 3%>
<FORM action="03result.asp" method="post">
<SELECT name="liste" size="5" multiple>
<%while not RS.eof%>
<option value="<%=RS("type")%>"><%=RS("type")%></option>
<%RS.moveNext
wend %>
</SELECT>
<INPUT type="submit" value="OK">
</FORM>
<%RS.close%>
</BODY></HTML>
<% conn.close : Set conn=nothing %>
ainsi que la page des résultats:
<!-- #include file="connexion.asp"-->
<link rel="stylesheet" href="tableaux.css">
<HTML><BODY>
<h3>Bienvenue sur ma base </h3>
<%SQL="SELECT * FROM [tarifs]"
Set RS2 = server.createobject("ADODB.Recordset")
RS2.Open SQL,Conn , 3, 3%>
<table border="1" width="80%">
<tr>
<td width="33%"><h2>Ref</h2></td>
<td width="33%"><h2>Déscription</h2></td>
<td width="34%"><h2>Prix</h2></td>
<td width="34%"><h2>Type</h2></td>
</tr>
<%while not RS2.eof
For i = 1 To Request.Form("liste").Count
if RS2("type")=Request.Form("liste")(i) then%>
<tr>
<td width="33%"><A HREF='<%=RS2("ref")%>.htm'><%=RS2("ref")%></td>
<td width="33%"><%=RS2("description")%></td>
<td width="34%"><%=RS2("prix")%></td>
<td width="34%"><%=RS2("type")%></td>
</tr>
<%end if
next
RS2.moveNext
wend
RS2.close%>
</table>
Et pour finir le fichier de connexion:
<%
' Path long de la base de données
dbPath = Server.MapPath("/pc.mdb")
' Création de l'objet permettant la connexion
Set Conn = Server.CreateObject("ADODB.Connection")
' Connexion
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};" _
& " DBQ=" & dbPath
%>
Qu'est ce qui ne marche pas bien ? Je suis novice en asp...
Merci d'avance.