回 帖 发 新 帖 刷新版面

主题:[讨论]这段代码哪里出错了?

我是新手,刚入手,现想改一个网站的小程序,结果怎是出错.望各位大虾帮帮我!
错误类型:
ADODB.Recordset (0x800A0BCD)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/xinyu/test.asp, 第 35 行

<%

dim i,sql,rs,count,temp,strid1,strid2
strid1=""
strid2=""
randomize
for i=1 to session("singlenumber")
set rs=server.createobject("adodb.recordset")
sql="select * from question where subjectname='"&session("selectsubjectname") & "'and type='单选题' and haveselect=0 "
rs.open sql,conn,3,2
count=rs.recordcount
temp=fix(count*rnd(20))
[color=800000]rs.move temp[/color]
rs("haveselect")=1

strid1=strid1 & rs("ID") & ","

%>

回复列表 (共2个回复)

沙发

你应该把数据库的游标好好看看,用Move到制定记录,需要一个可以前后滚动的游标

板凳

<%

dim i,sql,rs,count,temp,strid1,strid2
strid1=""
strid2=""
randomize
for i=1 to session("singlenumber")
set rs=server.createobject("adodb.recordset")
sql="select * from question where subjectname='"&session("selectsubjectname") & "'and type='单选题' and haveselect=0 "
rs.open sql,conn,2,2

count=rs.recordcount
temp=fix(count*rnd(20))
rs.move temp
if not rs.eof and not rs.bof then
rs("haveselect")=1

strid1=strid1 & rs("ID") & ","
else response.write"信息有误,请仔细查看!"
end if

%> 
 

我来回复

您尚未登录,请登录后再回复。点此登录或注册