[thelist] Access DB & getting random records using ASP

Ken Schaefer ken at adOpenStatic.com
Fri Apr 2 06:52:28 CST 2004


You're running into a seed caching issue.

I have some code on my site you can use:
www.adopenstatic.com/faq/randomrecord.asp

(oh, I notice you used that already...)

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Christian Anderson" <lists at photokyo.com>
Subject: [thelist] Access DB & getting random records using ASP


: I have a script that has been working fine for long time now, and it has
all
: of a sudden stopped doing what it should. Basically it pulls 5 random
: records out of one of my tables in an access database. It worked fine
: before, but now it just shows the same 5 each and every time.
:
: The URL where I'm testing it is here:
:
: http://www.photokyo.com/test/random.asp
:
: and the code is:
:
: <%
: RANDOMIZE
: SQL = "select TOP 5 tSMALLIMAGE, aID, rnd(aID) as randOrder
: from t_gallery ORDER BY Rnd(aID)"
: set conn = server.createobject("ADODB.Connection")
: conn.open "photokyo-pt"
: set gall_random=conn.execute(SQL)
:
: Response.Write("<table border=0 width=90 align=center
: cellpadding=0 cellspacing=0>")
:
: DO WHILE NOT gall_random.EOF
: Response.Write("<tr align=center>")
: Response.Write("<td>")
: Response.Write("<table border=0 height=60 width=80
: cellpadding=1 cellspacing=0>")
: Response.Write("<tr>")
: Response.Write("<td bgcolor=#FFFFFF><a
: href=/showpicture.asp?number=" & gall_random(1) & "><img border=0 src=" &
: gall_random(0) & "></a></td>")
: Response.Write("</tr></table>")
: Response.Write("</td></tr>")
: Response.Write("<tr height=3><td></td></tr>")
: gall_random.movenext
: LOOP
: gall_random.close
:
: Response.Write("</table>")
: %>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the thelist mailing list