set rs = conn.execute(‘Select count(id) from someTable‘) rCount = rs(0)
‘ ***** (step 2) *****
set rs = conn.execute(“select id from someTable”) cnt = 1 dim RRs redim RRs(rCount) do while not rs.eof RRs(cnt) = rs(0) cnt = cnt + 1 rs.movenext loop
‘ ***** (step 3) *****
randomize currentRR = cLng(rnd*rCount+0.5) ID = RRs(currentRR)
‘ ***** (step 4) *****
sql = “select otherfield from someTable where id=” & ID set rs = conn.execute(sql) response.write “ID # ” & ID & “ = ” & rs(0) rs.close: set rs = nothing conn.close: set conn = nothing %$#@62; 对于SQL Server,还有更加有效率的方法。比如设计两个存储过程。我这里只是阐明一些思路,并希望这种思路可以同时用在Access和SQL Server中。