标题:asp分页错误 求助 ?
只看楼主
arthur_wy
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-1-21
结帖率:0
已结贴  问题点数:20 回复次数:1 
asp分页错误 求助 ?
<%
page = cint(request("page"))

if page= "" then
page = 1
end if
response.Write(page)
mypagesize  =8
Set rs =Server.CreateObject("Adodb.RecordSet")  ''定义查询指针
sql = "select * from news where categoryid = " & id  & "  order by id desc "
rs.open sql,conn,1,1
rs.pagesize = mypagesize
pages=cint(rs.pagecount)
if page<1 or page >  pages then
page = 1  
end if
<br>一共<%= pages %>页,每页<%= mypagesize %>条<%
if pages>1 and page>1 then
Response.Write("<a href=?page=1>第一页</a>  ")
end if
if page>1 and pages>1 then
Response.Write("<a href=?page=" & page-1 & ">上一页</a>  ")
end if
if page<pages and pages>1 then
Response.Write("<a href=?page=" & page+1 & ">下一页</a>  ")
end if
if page<pages and pages>1 then
Response.Write("<a href=?page=" & pages & ">尾页</a>  ")
end if  %>
请问下 这个分页为什么一点第二页就出错额  页面运行是http://localhost/news/list.asp?id=1
点下一页后 变成
http://localhost/news/list.asp?page=2
然后就是显示错误
An error occurred on the server when processing the URL. Please contact the system administrator.
If you are the system administrator please click here to find out more about this error.
搜索更多相关主题的帖子: sql request where 
2013-01-21 22:24
hu9jj
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:红土地
等 级:贵宾
威 望:396
帖 子:11713
专家分:43267
注 册:2006-5-13
得分:20 
没有看到对变量id的定义或赋值啊。
将这句的id改成page试试
sql = "select * from news where categoryid = " & page & "  order by id desc "

活到老,学到老! http://www. E-mail:hu-jj@
2013-01-22 09:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-397268-1-1.html




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

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