错误为"没有找到您需要的内容",请高手看下我的判断是否正确并帮忙找原因?

<!-- #include file="function.inc.asp" -->(此处为引用分页)
<%
dim conn,dbpath,sql,rs,i
set conn=Server.CreateObject("adodb.connection")
conn.open "DRIVER=Driver do Microsoft Access (*.mdb);DBQ="&Server.MapPath(dbpath & "zhigong.mdb")
%>

<%

if request.QueryString("page")="" then
page=1
else
page=cint(request.QueryString("page"))
end if
pagelistnum=10
bb=request("bb")
if bb<>""then
set rs=server.CreateObject("adodb.recordset")
sql="select * from zhigong where 姓名 like '%"&bb&"%'"

rs.open sql,conn,1,1
rs.PageSize=pagelistnum
rs.AbsolutePage=page
if not rs.eof then
else
response.write("没有找到您需要的内容")
i=1
do while not (rs.eof or i=rs.pagesize)
%>

<table width="360" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><%=rs("姓名")%></td>
</tr>
</table>
<%rs.movenext
i=i+1
loop

end if
rs.close
link="查询.asp?t="

sql="select count(*) as num from zhigong where 姓名 like '%"&bb&"%'"
fy sql,page,pagelistnum,link

end if %>

错误为在搜索非表内数据时超出范围无法判断,请高手看下我的判断是否正确并找到原因
错误提示:BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。

侃侃无极
浏览 174回答 2
2回答

慕莱坞森

主要是判断错误,先看一下你的代码:if not rs.eof then '如果不为空else ' 为空的话do while not (rs.eof or i=rs.pagesize)'执行循环……rs.movenextloopend if在空的情况下执行Do while Not Rs.eof系统自然提示错,所以改一下:if rs.eof then '就这里改一下去掉 not即可elsedo while not (rs.eof or i=rs.pagesize)……rs.movenextloopend if

慕尼黑8549860

<%dim 姓名姓名=request("姓名")set rs=server.CreateObject("adodb.recordset")sql="select * from zhigong order by 姓名 desc"rs.open sql,conn,1,1if 姓名="" thenresponse.write"没有找到您需要的内容"response.endend if%>
打开App,查看更多内容
随时随地看视频慕课网APP