[thelist] Access DB & getting random records using ASP

Christian Anderson lists at photokyo.com
Fri Apr 2 01:58:43 CST 2004


Hi,

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>")
		%>
		

I emailed the host asking if they disabled anything like RANDOMIZE and they
said they haven't touched anything. Any suggestions? Possibly another way to
do this?




More information about the thelist mailing list