28,406
社区成员
发帖
与我相关
我的任务
分享<%
'On Error Resume Next
'连接数据库
dim db,conn,rs
db = "provider=microsoft.jet.oledb.4.0;data source=" & server.mappath("./db.mdb")
set conn = server.createobject("adodb.connection")
set rs = server.createobject("adodb.recordset")
conn.open db
dim timestr,sqlstr
Randomize
timestr = second(now())*second(now())* second(now())
timestr = rnd(timestr)
timestr = "0" & timestr
timestr = 100000 * timestr
Set rs=server.CreateObject("adodb.recordset")
sql = "select top 10 * from table1 order by " & timestr & " mod id,id desc"
rs.open sql,conn,1,1
If not Rs.BOF Then
do while not rs.eof
response.Write rs("id")&":"&rs("aaaa")&"<br>"
rs.movenext
loop
end if
%>
<%
'释放资源
conn.close
set conn = nothing
%>dim timestr,sqlstr
Randomize
timestr = second(now()) * second(now()) * second(now()) timestr = rnd(timestr) timestr = "0" & timestr
timestr = 100000 * timestr
sqlstr = "select top 10 * from table order by " & timestr & " mod id"
select top 10 * from myTable Order By NewID()
'执行检索
Count=rs.RecordCount
'得到记录总数
Item=10
if Count < Item then
Item=Count
end if