Ho provato a realizzare un altro codice di questo tipo:
codice:
Dim dtmToDay
dtmToDay = Date()
sql="SELECT * FROM giorni Order by numeri Desc"
call apridb(sql, rs, conn)
if rs.recordcount>0 then
while not rs.eof
%>
<%
If WeekDay(dtmToDay) = rs("numeri") Then
Response.Write(WeekdayName(weekDay(dtmToDay), False) & "" & Day(dtmToDay) & "" & MonthName(Month(dtmToDay)))
Else
Response.Write("NO")
End IF
%>
<%
rs.movenext
wend
end if
call chiudidb(rs, conn)
%>
Dim dtmToDay
dtmToDay = Date()
sql="SELECT * FROM giorni Order by numeri Desc"
call apridb(sql, rs, conn)
if rs.recordcount>0 then
while not rs.eof
%>
<%
If WeekDay(dtmToDay) = rs("numeri") Then
Response.Write(WeekdayName(weekDay(dtmToDay), False) & "" & Day(dtmToDay) & "" & MonthName(Month(dtmToDay)))
Else
Response.Write("NO")
End IF
%>
<%
rs.movenext
wend
end if
call chiudidb(rs, conn)
%>
Dim dtmToDay
dtmToDay = Date()
sql="SELECT * FROM giorni Order by numeri Desc"
call apridb(sql, rs, conn)
if rs.recordcount>0 then
while not rs.eof
%>
<%
If WeekDay(dtmToDay) = rs("numeri") Then
Response.Write(WeekdayName(weekDay(dtmToDay), False) & "" & Day(dtmToDay) & "" & MonthName(Month(dtmToDay)))
Else
Response.Write("NO")
End IF
%>
<%
rs.movenext
wend
end if
call chiudidb(rs, conn)
%>
Dove stampo NO, devo eseguire il calcolo sulle date in modo da far stampare il valore della data più vicina.
Questo codice funziona.
Mi mostra la data di oggi solo nei due record che hanno 2 nel database (la data è rifrerita al giorno in cui ho fatto la prova).