step 一: sql="select id from table" 結果用存在 rs=conn.execute(sql)
step 二: 生成一個 step1的最大值(rs.recordcount)內的隨機數字. N個
code:
<%Randomize %>
<%
dim r(10)
for i=0 to UBound(r)
r(i)=int(Rnd()*100)
int(Rnd()*100)
%>
step 三: 將數組聯合 join成一個","分割的
復制代碼 代碼如下:
<%Randomize %>
<%
sql="select id from table"
rs=conn.execute(sql)
maxrecord=rs.recordcount
dim r(10)
for i=0 to ubound(r)
r(i)=rs(int(rnd()*maxrecord))
next
s=join(r,",")
sql="select * from table where id in("&s&")"
newrs=conn.execute(sql)
%>