| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 451 人关注过本帖
标题:[求助] 分页问题?
只看楼主 加入收藏
huangwang
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2006-6-1
收藏
 问题点数:0 回复次数:1 
[求助] 分页问题?

做了个网页,里面的分页只能实现前一页,下一页,但到最后一页就出现:错误类型:
ADODB.Field (0x80020009)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/type.asp

代码用dw做的,有些长.
网址显示为:http://huangjiwei.zpgo.net/
代码为:
<!--#include file="conn.asp"-->
<%l_leixing=request("l_leixing"%>
<%l_id=request("l_id"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<Script LANGUAGE="JavaScript">
if(self!=top){top.location=self.location;}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>
<%
set rs=conn.execute("select*from leixing"
if rs.eof and rs.bof then
response.Write("暂无记录!"
else
do while not rs.eof
%>
<%=rs("l_leixing"%>
<%
rs.movenext
loop
end if
%>
</title>
<%rs.close%>
<style type="text/css">
<!--
.style1 {
font-family: "方正舒体";
font-size: 36px;
}
body {
margin-top: 0px;
margin-bottom: 0px;
}
.unnamed1 {
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: none;
border-right-style: none;
border-bottom-style: dashed;
border-left-style: none;
border-top-color: #CCFF66;
border-right-color: #CCFF66;
border-bottom-color: #CCFF66;
border-left-color: #CCFF66;
}
body,td,th {
font-family: 宋体;
font-size: 12px;
}
.style2 {
color: f666666;
font-weight: bold;
}
.style3 {color: #FF0000}
.style4 {color: #FF0000; font-weight: bold; }
a:link {
color: #000000;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
color: #FF0000;
}
a:active {
text-decoration: none;
color: #FF0000;
}
-->
</style>
<meta name="keywords" content="3Dmx视频教程,ASP视频教程,Photoshop视频教程,Dreamweaver视频教程,Flash视频教程,Frieworks视频教程">
<meta name="" content="3Dmx视频教程,ASP视频教程,Photoshop视频教程,Dreamweaver视频教程,Flash视频教程,Frieworks视频教程">
</head>

<body>

<div align="center">
<table width="100%" height="142" >
<tr>
<td height="136" background="images/banner2.gif"><table width="100%" height="134" >
<tr>
<td width="25%" height="128"><div align="center" class="style1">视频教程网</div></td>
<td width="75%"><div align="center">
<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="736" height="132">
<param name="movie" value="34.swf">
<param name="quality" value="high">
<param name="wmode" value="transparent">
<embed src="34.swf" width="736" height="132" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" volue="transparent"></embed>
</object>
</div></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" height="34" background="images/z_bg.gif" >
<tr>
<td height="28"><div align="left">
<table width="964">
<tr>
<%
sql="select*from leixing"
set rs=server.CreateObject("adodb.recordset"
rs.open sql,conn,1,1
%>
<%if rs.eof and rs.bof then
response.End()
else
do while not rs.eof
%>
<td width="679"><div align="center">| <a href="type.asp?l_id=<%=rs("l_id"%>" target="_parent"><%=rs("l_leixing"%></a>|</div></td>
<%
rs.movenext
loop
end if
%>
<%rs.close%>
</tr>
</table>
</div></td>
</tr>
</table>
<table width="100%" >
<tr>
<td height="61"><div align="left">

<table width="100%" >
<tr>
<td><div align="left">您现在的位置&gt;&gt;&gt;<a href="index.asp" target="_parent">返回首页</a>&gt;&gt;&gt;
<%
sql="select*from neirong where l_id="&l_id&" order by time desc"
set rs=server.CreateObject("adodb.recordset"
rs.open sql,conn,1,1
if rs.bof then
response.End()
else
%>
<%=rs("l_leixing"%>


</div></td>
</tr>
</table>

</div></td>
<td> </td>
</tr>
</table>
<table width="100%" cellspacing="1" bgcolor="#CCFF66" >
<tr background="images/navbg.gif">
<td height="25" background="images/navbg.gif"><div align="center">教程名称</div></td>
<td background="images/navbg.gif"><div align="center"> 点击数 </div></td>
<td background="images/navbg.gif"><div align="center"> 发布者 </div></td>
<td background="images/navbg.gif"><div align="center"> 来源 </div></td>
<td background="images/navbg.gif"><div align="center"> 添加时间 </div></td>
<td background="images/navbg.gif"><div align="center"> 类型 </div></td>
</tr>

<%


page=request.querystring("page" ';page值为接受值
rs.PageSize = 25 ';每页显示记录数
if Not IsEmpty(page) then ';如果page已经初始化...
if Not IsNumeric(page) then ';判断page值是否为数字
page=1
else
Page = cint(page) ';接收page并化为数字型赋给page变量
end if
if Page > rs.PageCount then ';如果接收的页数大于总页数
rs.AbsolutePage = rs.PageCount ';设置当前显示页等于最后页
elseif Page <= 0 then ';如果page小于等于0
rs.AbsolutePage = 1 ';设置当前显示页等于第一页
else
rs.AbsolutePage = Page ';如果大于零,显示当前页等于接收的页数
end if
else
rs.AbsolutePage=1
end if
%>
<%
For i = 1 to rs.PageSize ';利用for next 循环依次读出当前页的记录
if rs.EOF then
Exit For
end if
%>

<tr bgcolor="#FFFFFF">
<td height="25"><div align="center"><a href="show.asp?n_id=<%=rs("n_id"%>" target="_parent"><%=rs("mingcheng"%></a></div></td>
<td><div align="center"><%=rs("dianji"%></div></td>
<td><div align="center"><%=rs("fabuzhe"%></div></td>
<td><div align="center"><%=rs("laiyuan")%></div></td>
<td><div align="center"><%=rs("time")%></div></td>
<td><div align="center"><%=rs("l_leixing")%></div></td>
</tr>
<%
rs.MoveNext
Next
%>
<tr bgcolor="#FFFFFF">
<td height="25" colspan="6"><div align="center">
<form action="<%=filepath%>" method="get">
<!--首先保证总页数不为1、不为0-->
<%if rs.pagecount<>1 and rs.pagecount<>0 then%>
<!--如果当前页数大于1,无论何时都应显示首页和上一页的连接-->
<%if page>1 then%>
[<a Href="<%=filepath%>?l_id=<%=rs("l_id")%>&Page=<% = 1%>">首页</a>] [<a Href="<%=filepath%>?l_id=<%=rs("l_id")%>&Page=<% = page -1 %>">上一页</a>]
<!--如果当前页数大于1并且小于总页面数时,显示出尾页和下一页的连接-->
<%if page<rs.pagecount then %>
[<a Href="<%=filepath%>?l_id=<%=rs("l_id")%>&Page=<% = page + 1%>">下一页</a>] [<a Href="<%=filepath%>?l_id=<%=rs("l_id")%>&Page=<% = rs.PageCount%>">尾页</a>]
<!--如果当前页数大于1并且仍大于或等于总页面数时,不显示出尾页和下一页的连接-->
<%else%>
[下一页] [尾页]
<%end if%>
<!--否则,当前页数不大于1,则只显示尾页和下一页的连接-->
<%else%>
[首页] [上一页] [<a Href="<%=filepath%>?l_id=<%=rs("l_id")%>&Page=<% = page + 1%>">下一页</a>] [<a Href="<%=filepath%>?l_id=<%=rs("l_id")%>&Page=<% = rs.PageCount%>">尾页</a>]
<%end if %>
<!--最终,总页数若为1、为0则没有任何连接-->
<%else%>
[首页] [上一页] [下一页] [尾页]
<%end if%>
[页次:<font color=red><b><%=page%></b></font>/<%=rs.PageCount%>] [共<%=rs.RecordCount%>篇 <font color=red><b><%=rs.PageSize%></b></font>篇/页] 转到
<input name="page" size=5 value="<%=page%>">

<input name="submit" type="submit" value="Enter">
</form>
<p> </p>
</div></td>
</tr>

<%end if%>
</table>
<p>
<%
rs.close
Set rs = Nothing
conn.close
set conn=Nothing
%> </p>
<table width="100%" height="92" >
<tr>
<td><div align="center">
<table width="600">
<tr>
<td> </td>
</tr>
<tr>
<td><div align="center">| <span onclick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('http://huangjiwei.zpgo.net/');" style="CURSOR: hand">设为首页</span> | | 联系站长 | | 登陆管理 | | 免责声明 | | 关于我们| </div></td>
</tr>
<tr>
<td><div align="center">本站由huangwang维护©2006</div></td>
</tr>
</table>
</div></td>
</tr>
</table>
</div>
</body>
</html>
请高手帮忙看看,很郁闷!

搜索更多相关主题的帖子: request include PUBLIC color file 
2006-09-11 11:34
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
虽然用一个rs对象的确省内存,但是频繁的close和open也有可能发生意想不到的错误。
2006-09-11 23:19
快速回复:[求助] 分页问题?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022002 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved