To extract a record from a database using a random number.
Estract the table elements and then I get a random number
<%
' query SQL
strSQLMax = "SELECT Max(ID) as MaxVal FROM tabella ORDER BY ID"
strSQL = "SELECT Top 1 ID, titolo FROM tabella Where ID = "
' open conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open strConn ' la stringa di conn
' get max number
Set rs = conn.Execute(strSQLMax)
intMax = rs("maxVal")
rs.Close
set rs = Nothing
' random number
Randomize()
intRandom = CInt ((Rnd() * intMax) + 1)
' get the record
Set rs = conn.Execute(strSQL & intRandom)
' show record
' ...
rs.Close
set rs = Nothing
conn.Close
set conn = Nothing
%>