·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> ASP网站建设 >> ACC数据库ASP随机读取N条数据

ACC数据库ASP随机读取N条数据

作者:佚名      ASP网站建设编辑:admin      更新时间:2022-07-23

以下的代码仅仅是例子,大家如果有需要的话就根据这个例子进行修改使用!
一般来说,ACC是足够应付站点的,除非是你非常大型,不然ACC还是非常不错的!

 

 程序代码
<%
dim sjtop,Aa,le
'准备读取多少记录
le=5
Set sjtop = Server.CreateObject("ADODB.Recordset")
sjtop.open "select * from 库名",conn,1,3
Aa = sjtop.recordcount-le
sjtop.move(randsub(Aa))
if sjtop.eof then
%>
不存在数据
<%end if%>
<%
for i = 1 to le %>
内容
<%
sjtop.movenext
next 
sjtop.close
'取随机数
Function Randsub(total)
Randomize
Randsub = int((total-1+1)*rnd+1)
end Function
%>