je suis en train de créer une application permettant de réserver du matériel dans une entreprise.
Pour cela, les utilisateurs doivent sélectionner le matériel et indiquer ensuite les dates de reservation. Bien entendu, le même appareil ne peut pas être réservé deux fois le même jour. J'aimerai donc qu'un message apparaisse si quelqu'un sélectionne une date déjà prise. Malheureusement, je ne sais pas du tout comment faire...
Voici le code de ma page :
<%
NoPretReservation = request.QueryString("NoPretReservation")
NomReservation = request.QueryString("NomReservation")
LoginReservation = request.QueryString("LoginReservation")
DateDebutReservation = request.QueryString("DateDebutReservation")
DateFinReservation = request.QueryString("DateFinReservation")
NoPretMateriel = request.QueryString("NoPretMateriel")
Valider = request.QueryString("Valider")
set RS = Server.CreateObject("ADODB.recordset")
ConnString ="driver={SQL Server}; server=XXXXX;uid=dbIntraInterHevs; pwd=XXX;database=XXX"
if request.QueryString("Supp") = "ok" then
RS.Open "select * from PretReservation", ConnString, 2, 3, 8
RS.Find "NoPretReservation =" &NoPretReservation
RS.Delete
RS.Close
Response.Redirect("index.asp?nocategorie="&request.QueryString("nocategorie")&
"&NoPage=1501&nolangue="&request.QueryString("nolangue")&"&
noDomaine="&request.QueryString("noDomaine")&"&NoPretMateriel="&
NoPretMateriel)
end if
%>
<%
if Valider = "Valider" then
RS.Open "select * from PretReservation", ConnString, 2, 3, 8
RS.addnew()
rs("DateDebutReservation") = DateDebutReservation
rs("DateFinReservation") = DateFinReservation
rs("NomReservation") = NomReservation
rs("LoginReservation") = session("Login")
rs("NoPretMateriel") = NoPretMateriel
RS.update
RS.close
%>
Réservation effectuée !<br>
<br>
<a href="index.asp?nocategorie=<%=request.QueryString("nocategorie")%>&NoPage=1501&
nolangue=<%=request.QueryString("nolangue")%>&noDomaine=<%=request.QueryString("
noDomaine")%>&NoPretMateriel=<%=request.QueryString("NoPretMateriel")%>"
>Retour</a>
<%
else
RS.Open "select * from PretMateriel where NoPretMateriel="&NoPretMateriel, ConnString, 2, 3, 8
%>
<form name="FormMateriel" method="get" action="index.asp">
<table border="0" cellpadding="0" cellspacing="5">
<tr>
<td valign="top" width="15%"><b>Matériel</b></td>
<td valign="top"><b>:</b></td>
<td valign="top"><b><%= rs("NomMateriel")%></b></td>
</tr>
<tr><td valign="top"> </td></tr>
<tr>
<td valign="top" width="15%">Description</td>
<td valign="top">:</td>
<td valign="top" align="justify"><em><%= rs("DescriptionMateriel")%></em></td>
</tr>
<tr><td valign="top"> </td></tr>
<tr>
<td valign="top" width="15%">Login</td>
<td valign="top">:</td>
<td valign="top"><%= session("login")%></td>
</tr>
<tr><td valign="top"> </td></tr>
<input type="hidden" name="nocategorie" value="<%=request.QueryString("nocategorie")%>">
<input type="hidden" name="NoPage" value="<%=request.QueryString("NoPage")%>">
<input type="hidden" name="nolangue" value="<%=request.QueryString("nolangue")%>">
<input type="hidden" name="noDomaine" value="<%=request.QueryString("noDomaine")%>">
<input type="hidden" name="NoPretMateriel" value="<%=NoPretMateriel%>">
<tr>
<td valign="top">Nom</td>
<td valign="top">:</td>
<td valign="top"><input type="text" name="NomReservation"></td>
</tr>
<tr><td valign="top"> </td></tr>
<%session.lcid = 2048%>
<tr>
<td valign="top" width="15%">Date de début</td>
<td valign="top">:</td>
<td valign="top">
<select name="DateDebutReservation">
<%
for i = 1 to 365
DateDebut = date() + i
%>
<option value="<%= DateDebut %>"><%= DateDebut %></option>
<%next%>
</select>
</td>
</tr>
<tr><td valign="top"> </td></tr>
<tr>
<td valign="top" width="15%">Date de fin</td>
<td valign="top">:</td>
<td valign="top">
<select name="DateFinReservation">
<%
for i = 1 to 365
DateFin = date() + i
%>
<option value="<%= DateFin %>"><%= DateFin %></option>
<%next%>
</select>
</td>
</tr>
<tr><td valign="top"> </td></tr>
</table>
<input type="submit" name="Valider" value="Valider"><input type="reset">
</form>
<%
RS.Close
%>
<a href="index.asp?nocategorie=<%=request.QueryString("nocategorie")%>&NoPage=1500&
nolangue=<%=request.QueryString("nolangue")%>&noDomaine=<%=request.QueryString("
noDomaine")%>">Retour</a>
<hr>
<%session.lcid = 1033%>
<%RS.Open "select * from PretMateriel, PretReservation where PretMateriel.NoPretMateriel = PretReservation.NoPretMateriel and PretMateriel.NoPretMateriel="&NoPretMateriel&" order by DateDebutReservation", ConnString, 2, 3, 8%>
<%session.lcid = 2048%>
<p class="titre2">Dates réservées :</p>
<%if rs.eof = true then%>
Il n'y a aucune réservation pour l'instant.
<%else%>
<table border="0" bordercolor="#047cb4" cellpadding="5" cellspacing="0">
<tr>
<td align="center" width="25%"> </td>
<td align="center"><b>Début</b></td>
<td align="center"><b>Fin</b></td>
<td align="center" width="25%"> </td>
</tr>
<%do while rs.eof = false%>
<%if rs("DateFinReservation") >= date then%>
<tr>
<td align="center" width="25%"> </td>
<td align="center"><%=rs("DateDebutReservation")%></td>
<td align="center"><%=rs("DateFinReservation")%></td>
<td align="center" width="25%"><%if rs("LoginReservation") = session("Login") then%><a href="index.asp?nocategorie=<%=request.QueryString("nocategorie")%>&NoPage=1501&
nolangue=<%=request.QueryString("nolangue")%>&noDomaine=<%=request.QueryString("
noDomaine")%>&NoPretMateriel=<%=rs("NoPretMateriel")%>&NoPretReservation=<
%=rs("NoPretReservation")%>&Supp=ok">Effacer</a><%else%>
<%end if%></td>
</tr>
<%end if%>
<%
rs.movenext
loop
%>
</table>
<%end if
RS.Close
Set rs = nothing
end if
%>
Et voici à quoi ressemble ma page :
[IMG=http://img14.imageshack.us/img14/3259/reservv.jpg][/IMG]
[IMG=http://img14.imageshack.us/img14/reservv.jpg/1/w573.png][/IMG]
Pouvez-vous m'aider ?
Merci beaucoup



Haut











