求助,关于随机调用题库的问题

小末三 2004-05-07 03:19:02
大家帮我看看下面一段随机调用题库的程序,当我运行时,得到的题目有一些是重复的,谁能帮我改一下,让他调用的题目没有重复的,谢谢

randomize
sid=int((maxtype1+1)*rnd+1)
set rst=conn.execute("select * from type1 where id="&sid)

while rst.eof
randomize

sid=int((maxtype1+1)*rnd+1)
set rst=conn.execute("select * from type1 where id="&sid)
wend

...全文
76 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
小末三 2004-05-07
  • 打赏
  • 举报
回复
我的数据库是Access的 那要怎么办呢
zhouxinjie 2004-05-07
  • 打赏
  • 举报
回复
set rst=conn.execute("select top 10 from type1 order by newid()")
'----------也就是在type1表中随机挑选出10条记录。

只要这一句就可以拉,这样是不可能有重复的,不过还有一点要注意的是,其中newid()只能在sql server 2000中才支持的。好像应该是一个随机函数吧。
postfix2 2004-05-07
  • 打赏
  • 举报
回复
"select * from type1 where id="&sid

随机的产生

Select top 1 * from 表 order by newid()

小末三 2004-05-07
  • 打赏
  • 举报
回复
到地要怎么改呢

我还是不懂

可以详细一点吗

我很菜的
postfix2 2004-05-07
  • 打赏
  • 举报
回复
Select top 1 * from 表 order by newid()
skyboy0720 2004-05-07
  • 打赏
  • 举报
回复
select top 1 * from type1 order by newid()

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧