Suppose this data table has a unique ID field and has at least one record. Random access to one of the records of the method is very simple, can be divided into four steps: [Shanghai treatment of impotence Hospital editing and finishing]
1. Obtain the total number of records N.
2. Store all ID numbers in an array
3. Produce a random number m not greater than n
4. Remove the ID number from the array, query the data table, get the record data.
Here's some code:
$#@60;%
Set conn = Server.CreateObject (' ADODB. Connection ')
Conn.Open ' $#@60;conn string$#@62; '
* * * * * (step 1) * * * *
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 and 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;
For SQL Server, there is a more efficient method. For example, two stored procedures are designed. I'm just explaining some of the ideas, and I hope this idea can be used in both access and SQL Server.
ASP database programming: A record of random access to the recordset