永发信息网

asp随机从MDB数据库中读取一条记录并显示到网页上

答案:1  悬赏:50  手机版
解决时间 2021-11-26 13:15
  • 提问者网友:niaiwoma
  • 2021-11-25 23:20
asp随机从MDB数据库中读取一条记录并显示到网页上
最佳答案
  • 五星知识达人网友:不想翻身的咸鱼
  • 2021-11-25 23:39
nd是asp的一个随即函数,但是sql中并无此函数,故,你的这个sql语句是有问题的。
你可以这样写

<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 1 id from url order by id desc",conn,1,1
if not rs.bof and not rs.eof then
maxid=rs("id")
rs.close

function suiji()
Randomize
suiji=Int((maxid - 1+ 1) * Rnd + 1)
end function

'然后开始随即提取记录
i=0
do while i<1
rs.open "select * from url where id="&suiji(),conn,1,1
if not rs.bof and not rs.eof then
i=i+1
response.write "你现在随即提取的记录的id是"&rs("id")
end if
rs.close
loop
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯