|
dim min,sql,rs,rndID,i
minValue = 10
Randomize
sql = "Select * FROM table1 WHERE col1<"&minValue
Set rs = server.createobject("ADODB.RecordSet")
rs.Open sql,dbc,adOpenForwardOnly,adLockReadOnly
If rs.Eof Then
rs.Close
Set rs = Nothing
'show error, or donothing
End If
rndID = int(rnd*rs.RecordCount)
for i=0 to rndID - 1
rs.MoveNext
next
'now it is the random position, get data from rs
'do somthing you want
rs.Close
Set rs = Nothing |
|