ASP分页显示出错 10
我网页设计的思想是当查询数据库后,如果记录集为空则显示“没有相关结果”,如果记录集不为空则正常输出数据。而实际上当查询没有的结果,也就是记录集为空时网页没有按我的思想显示...
我网页设计的思想是当查询数据库后,如果记录集为空则显示“没有相关结果”,如果记录集不为空则正常输出数据。而实际上当查询没有的结果,也就是记录集为空时网页没有按我的思想显示,而现实如下文字。我的网页源文件如下,大师们看看帮我修改下。
ADODB.Recordset '800a0bcd'
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
\wwwroot\fabu\a.asp, line 204
网页源文件
......
<%
dim sj
sj=request.QueryString("fabu2")
oshen=request.QueryString("shen")
odaxue=request.QueryString("daxue")
if sj="" and oshen="" and odaxue="" then
exec="select * from nr order by id desc"
end if
if sj="" and oshen<>"" and odaxue<>"" then
exec="select * from nr where shen='"&oshen&"'and daxue='"&odaxue&"'order by id desc"
end if
if sj="" and oshen<>"" and odaxue="" then
exec="select * from nr where shen='"&oshen&"'order by id desc"
end if
if sj<>"" and oshen<>"" and odaxue<>"" then
exec="select * from nr where fabu='"&sj&"'and shen='"&oshen&"'and daxue='"&odaxue&"'order by id desc"
end if
if sj<>"" and oshen<>"" and odaxue="" then
exec="select * from nr where fabu='"&sj&"'and shen='"&oshen&"'order by id desc"
end if
if sj<>"" and oshen="" and odaxue="" then
exec="select * from nr where fabu='"&sj&"'order by id desc"
end if
set rs=server.CreateObject("adodb.recordset")
rs.open exec,cn,1,1
%>
......
<%
rs.pagesize=20
pagecount=rs.pagecount
page=int(request("page"))
if page<=0 then page=1
if request("page")="" then page=1
rs.absolutepage=page
%>
<%
if rs.eof and rs.bof then
response.write("还没有文章")
else
for i=1 to rs.pagesize
if rs.Eof then Exit for
%>
<tr bgcolor="#FCFEED" onmouseover="this.style.backgroundColor='#FFFF66'" onmouseout="this.style.backgroundColor=''">
<td width="387" height="25"><a href="xx.asp?id=<%=rs("id")%>" target="_blank"><%=rs("name")%></a></td>
<td width="177" height="25"><span class="STYLE2"><%=rs("daxue")%></span></td>
<td width="140" height="25"><span class="STYLE2"><%=rs("time")%></span></td>
</tr>
<%
rs.movenext
next
end if
%>
....... 展开
ADODB.Recordset '800a0bcd'
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
\wwwroot\fabu\a.asp, line 204
网页源文件
......
<%
dim sj
sj=request.QueryString("fabu2")
oshen=request.QueryString("shen")
odaxue=request.QueryString("daxue")
if sj="" and oshen="" and odaxue="" then
exec="select * from nr order by id desc"
end if
if sj="" and oshen<>"" and odaxue<>"" then
exec="select * from nr where shen='"&oshen&"'and daxue='"&odaxue&"'order by id desc"
end if
if sj="" and oshen<>"" and odaxue="" then
exec="select * from nr where shen='"&oshen&"'order by id desc"
end if
if sj<>"" and oshen<>"" and odaxue<>"" then
exec="select * from nr where fabu='"&sj&"'and shen='"&oshen&"'and daxue='"&odaxue&"'order by id desc"
end if
if sj<>"" and oshen<>"" and odaxue="" then
exec="select * from nr where fabu='"&sj&"'and shen='"&oshen&"'order by id desc"
end if
if sj<>"" and oshen="" and odaxue="" then
exec="select * from nr where fabu='"&sj&"'order by id desc"
end if
set rs=server.CreateObject("adodb.recordset")
rs.open exec,cn,1,1
%>
......
<%
rs.pagesize=20
pagecount=rs.pagecount
page=int(request("page"))
if page<=0 then page=1
if request("page")="" then page=1
rs.absolutepage=page
%>
<%
if rs.eof and rs.bof then
response.write("还没有文章")
else
for i=1 to rs.pagesize
if rs.Eof then Exit for
%>
<tr bgcolor="#FCFEED" onmouseover="this.style.backgroundColor='#FFFF66'" onmouseout="this.style.backgroundColor=''">
<td width="387" height="25"><a href="xx.asp?id=<%=rs("id")%>" target="_blank"><%=rs("name")%></a></td>
<td width="177" height="25"><span class="STYLE2"><%=rs("daxue")%></span></td>
<td width="140" height="25"><span class="STYLE2"><%=rs("time")%></span></td>
</tr>
<%
rs.movenext
next
end if
%>
....... 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询