|
|
|
| |
| 效率 |
添加时间:2006-12-26 |
|
| 公鸡指着一只鸵鸟蛋对母鸡说:“我并不是埋怨你,我只是提醒你注意,亲爱的,你看看人家外国,看看人家是怎么干活的。” |
|
| ·上一篇: 该到什麽地方 ·下一篇:
<{{anext}}> 〖关闭窗口〗 |
|
|
|
<%set rs=server.createobject("adodb.recordset")
sql="select articleid,title,syxs,sort from learning where syxs>0 and sort='"&sort&"' "
rs.open sql,conn,1,1
IF Not rs.Eof Then
'//定义n为总记录数,m为要随机提取记录数,m如为随机数则可随机提取m条记录
'//注意:m<=n
dim n,m
n=rs.recordcount
m=10
'//建立随机数组
Randomize
dim k,p,tp,i
For k=0 to 100000
p=fix(rnd*n)+1
if Not instr(tp,p)>0 then
tp=tp & p & ","
i=i+1
end if
if i>=m then exit for
Next
dim t
t=split(tp,",")
For i=0 To m-1 and not rs.eof
'//根据随机数组定位记录指针
rs.absoluteposition=t(i)%>
| |
<%if rs.eof then exit for
next
end if
%>
<%
rs.close
set rs=nothing
conn.close
set conn = nothing
%>
|
|
|