| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 989 人关注过本帖
标题:分页缺少对象问题
只看楼主 加入收藏
zhy328
Rank: 1
等 级:新手上路
帖 子:118
专家分:0
注 册:2007-8-9
结帖率:100%
收藏
 问题点数:0 回复次数:9 
分页缺少对象问题
这段代码 刚开始没问题 可是后来加了东西后提示说缺少对象,我找了半天也没弄明白那缺少对象
大家帮忙看看那出问题了

<%
Set rs=Server.CreateObject("ADODB.Recordset")
rs.open "select * from products order by id desc",conn,3,1
sumcount=rs.recordcount
if sumcount=0 then
response.Write("no list")
else
page=trim(request("page"))
if page="" then
page=1
end if
rs.pagesize=9
page=cint(page)
if page<1 then page=1
if page>rs.pagecount then page=rs.pagecount
intPageCount = rs.PageCount
rs.Absolutepage=page
%>


共有<font color="#FF0000"><%=sumcount%></font>条记录 共有<span class="style1"><%=page%><span class="style2">/</span><%=rs.pagecount%></span>页
<%if page<>1 then%>
[<a href="chanpin.asp?page=1">首页</a>][<a href="chanpin.asp?page=<%=page-1%>">上一页</a>]
<%end if%>
<%if page<>rs.pagecount then%>
[<a href="chanpin.asp?page=<%=page+1%>">下一页</a>][<a href="chanpin.asp?page=<%=rs.pagecount%>">尾页</a>]
<%end if%>
搜索更多相关主题的帖子: page 对象 Set sumcount 
2007-09-15 14:58
zsl5566
Rank: 1
来 自:泉州
等 级:新手上路
帖 子:163
专家分:0
注 册:2006-12-12
收藏
得分:0 
if not isempty(request.querystring("page")) then
pagecount=cint(request.querystring("page"))
else
pagecount=1
end if

不要给准备要做的事寻找失败的理由~~
2007-09-15 15:01
zsl5566
Rank: 1
来 自:泉州
等 级:新手上路
帖 子:163
专家分:0
注 册:2006-12-12
收藏
得分:0 
应该是缺少了一个想上面的判断

不要给准备要做的事寻找失败的理由~~
2007-09-15 15:05
zhy328
Rank: 1
等 级:新手上路
帖 子:118
专家分:0
注 册:2007-8-9
收藏
得分:0 
还是不对啊

2007-09-15 15:09
zsl5566
Rank: 1
来 自:泉州
等 级:新手上路
帖 子:163
专家分:0
注 册:2006-12-12
收藏
得分:0 

<%
if not isempty(request.querystring("page")) then
pagecount=cint(request.querystring("page"))
else
pagecount=1
end if


dim id
id=request("id")
set rs=server.CreateObject("adodb.recordset")
strsql="select * from web_news where sortid="&id
rs.open strsql,conn,3,3
%>
<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><img src="image/jiuye_<%=id%>.jpg" width="580" /></td>
</tr>
<tr>
<td>
<br>
<%if rs.bof and rs.eof then %>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25">&nbsp;&nbsp;&nbsp;&nbsp;对不起,暂时没有信息!</td>
</tr>
</table>
<%else
rs.pagesize=30
if pagecount>rs.pagecount or pagecount<=0 then
pagecount=1
end if
rs.AbsolutePage=pagecount
i=1

%>
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
<%do while not rs.eof
sortid=rs("sortid")
set ra=server.CreateObject("adodb.recordset")
sql="select * from web_news_class where id="&sortid
ra.open sql,conn,3,3
%>

<tr>
<td width="100">【<%=ra("sortname")%>】</td>
<td><a href="jxzx.asp?action=jyzx&id=<%=rs("id")%>"><%=rs("Topic")%></a></td>
<td width="30%"><font color="#999999"><%=rs("updatetimes")%></font></td>
</tr>
<% i=i+1
rs.movenext
if i>=rs.PageSize+1 then exit do
loop
%>
<tr>
<td width="100">&nbsp;</td>
<td colspan="2" align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="right">共<%=rs.pagecount%>页(<font color="#FF0000"><%=rs.recordcount%></font>)共条信息
<%if pagecount<=1 then%>
首页&nbsp;&nbsp;上一页
<%else%>
<a href="<%=Request.ServerVariables("PATH_INFO")%>?action=kszx&page=1">首页</a>&nbsp;&nbsp;<a href="<%=Request.ServerVariables("PATH_INFO")%>?action=kszx&page=<%=pagecount-1%>">上一页</a>&nbsp;&nbsp;
<%end if %>
<%for page=1 to rs.pagecount%>
<%
if pagecount=page then
link_color="red"
else
link_color=""
end if
%>
[<a href="<%=Request.ServerVariables("PATH_INFO")%>?action=kszx&page=<%=page%>"><font color="<%=link_color%>"><%=page%></font></a>]
<%next%>
<%if pagecount>=rs.pagecount then%>
下一页&nbsp;&nbsp;尾页
<%else%>
<a href="<%=Request.ServerVariables("PATH_INFO")%>?action=kszx&page=<%=pagecount+1%>">下一页</a>&nbsp;&nbsp;<a href="<%=Request.ServerVariables("PATH_INFO")%>?action=kszx&page=<%=rs.pagecount%>">尾页</a>
<%end if %>
<%end if%>

&nbsp; </div></td>
</tr>
</table> </td>
</tr>
</table>
</td>
</tr>
</table>
这是我的分页代码


不要给准备要做的事寻找失败的理由~~
2007-09-15 15:17
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
if page<1 then page=1
if page>rs.pagecount then page=rs.pagecount
改成
if page<1 then
page=1
end if
if page>rs.pagecount then
page=rs.pagecount
end if
试试
2007-09-15 15:20
zhy328
Rank: 1
等 级:新手上路
帖 子:118
专家分:0
注 册:2007-8-9
收藏
得分:0 
看不是很明白,我刚学ASP不久

2007-09-15 15:30
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
报什么错误?
2007-09-15 17:04
zhy328
Rank: 1
等 级:新手上路
帖 子:118
专家分:0
注 册:2007-8-9
收藏
得分:0 
if page<1 then page=1
if page>rs.pagecount then page=rs.pagecount
改成
if page<1 then
page=1
end if
if page>rs.pagecount then
page=rs.pagecount
end if
多谢各位!!

2007-09-18 11:27
syuanq
Rank: 2
等 级:新手上路
威 望:3
帖 子:297
专家分:0
注 册:2006-12-11
收藏
得分:0 
它是怎样报错的?

[url]www.[/url]欢迎大家的光临,一起交流学习
2007-09-19 02:02
快速回复:分页缺少对象问题
数据加载中...
 
   



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

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