Salve avrei bisogno di estrarre in modo casuale ad ogni caricamento di pagina dei record inseriti in un database access, usando la funzione randomize, questo è il mio codice, ma mi da il seguente errore
Funzione 'rand' non definita nell'espressione.
l'erroere è alla linea 7
questo è il codice:
<%
ID_grande = Request.QueryString("ID_grande")
Set OBJdbConnetcion = Server.CreateObject("ADODB.Connection")
OBJdbConnetcion.Open "DBQ=" & Server.Mappath("_db/quo_vadis.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
Set QRS = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT * FROM grande WHERE ID_grande = (rand() * (SELECT MAX(ID_grande) FROM grande))"
QRS.Open SQL, OBJdbConnetcion,1, 3
%>
<%
if QRS.EOF then
Response.Write "<tr><td>Nessun record trovato</td></tr>"
end if
Function taglia(testo, carattere)
If testo <= carattere Then
taglia = testo
Exit Function
end if
taglia = Mid(testo, 1, carattere)
END Function
While Not QRS.EOF
%>
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="50" class="td1"><div align="center">')">[img]_admin/quo_vadis/carica_foto.asp?id_grande=<%= QRS([/img]" width="50" height="40" border="0"></div></td>
</tr>
<tr>
<td class="td1"><div align="center"><font class="font5">')"><%response.write taglia(QRS("evento"),20)%>...</font></div></td>
</tr>
<hr size="1" color="#27438D" align="center">
</table>
<%
QRS.MoveNext
Wend
QRS.close
set QRS=Nothing
set OBJdbConnection=Nothing
%>

Rispondi quotando