求助分页问题

HuaBin59 2006-11-21 12:00:38
我定义了一个分类的页面
具体的问题是,我在读取的时候,页面能读取,可是点下一页的时候就不行了,请问是为什么?

具体看下面的代码

<div align="center"><%
dim rs
dim id
id=Request.QueryString("id")
if isnumeric(id)=0 or id="" then
response.write "非法ID参数"
response.end
end if
set rs=server.createobject("adodb.recordset")
dim page,count
if trim(request.querystring("page"))="" or isnumeric(trim(request.querystring("page")))=false then
page=1
else
page=cint(trim(request.querystring("page")))
end if
rs.open "select * from jobs where jobareasid="&id&"",conn,1,1
if not (rs.bof and rs.eof) then
rs.pagesize = pagesize
if page<1 then
page=1
end if
if page>rs.pagecount then
page = rs.pagecount
end if
rs.absolutepage = page
for count = 1 to rs.pagesize
if rs.eof then
exit for
end if
%>
<table border="0" width="90%" cellspacing="0" cellpadding="0" id="table6" style="border-bottom: 1px dotted #C0C0C0">
<tr>
<td>
<div align="center">
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table7">
<tr valign=top>
<td width="20%">
<p align="center">
<img border="0" src="images/hot.jpg" width="50" height="46"><br>
<font color="#FF9900" face="黑体" size="4">
<%=rs("jobhot")%></font><font size="2">人关注</font></td>
<td width="80%">
<p style="line-height: 150%; margin-left: 20px; margin-right: 10px">
<a href="workread.asp?id=<%=rs("jobid")%>">
<font color="#000000"><b><%=rs("jobtitle")%></b></font></a><br>
<%=left(rs("jobdiscrabe"),60)%><br><br><a href="workread.asp?id=<%=rs("jobid")%>">
<font size="2" color="#000000">阅读全部内容...</b></font></a><br></td>
</tr>
</table>
</div><br>
</td>
</tr>
</table>
<p align="center"><b><%
rs.movenext
next
if page>1 then
%></b><a href="workclass.asp?id=<%=jobareasid%>&page=1"><font size="4" color="#993300"><span style="text-decoration: none">首页</span></font></a><font size="4"><font color="#993300"> </font><a href="workclass.asp?id=<%=jobareasid%>&page=<%=page-1%>"><font color="#993300"><span style="text-decoration: none">上一页</span></font></a><font color="#993300"> <%
else
%><%
end if
if page > 1 then
%><%
end if
for count=page-0 to page+0
if count>=1 and count<=rs.pagecount then
if count=page then
%><%
else
%><%
end if
end if
next
if page<rs.pagecount-5 then
%><%
end if
if page < rs.pagecount then
%></font><a href="<%=jobareasid%>&page=<%=page+1%>"><font color="#993300"><span style="text-decoration: none">下一页</span></font></a><font color="#993300"> </font><a href="workclass.asp?id=<%=jobareasid%>&page=<%=rs.pagecount%>"><font color="#993300"><span style="text-decoration: none">尾页</span></font></a><b><font color="#3399FF"><%
else
%><%
end if
end if
rs.close
%>
<div align="center">
<table border="0" width="90%" cellspacing="0" cellpadding="0" id="table8">
<tr>
<td>
</td>
</tr>
</table>
</div>
</div>

点下一页,就是提示,非法参数ID
显示正确效果应该是

class.asp?id=相应的值&page=相应的值

可是我这无法读取出ID的值,可以从下面看出,错误是

class.asp?id=&page=相应的值

id 后面的值无法读取,请问该怎么做呢?
...全文
237 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Been_H 2006-11-28
  • 打赏
  • 举报
回复
直接
id=<%=id%>
hanyulou2003 2006-11-21
  • 打赏
  • 举报
回复
><a href="workclass.asp?id=<%=jobareasid%>&page=<%=page+1%>">
你翻页连接了什么?应该是当前的+1或者-1。

<%=session("CurrentPage")+1%>

我目前用的:
<%
sql_str="******"
Obj_rd.open sql_str,Obj_conn,1,1
Obj_rd.PageSize=48 //行数定义
if IsNumeric(Request.Querystring("Page")) then
ThePage=CLng(Request.Querystring("Page"))
else
ThePage=1
end if
if ThePage>Obj_rd.pagecount then
session("CurrentPage")=Obj_rd.pagecount
elseif ThePage<1 then
session("CurrentPage")=1
else
session("CurrentPage")=ThePage
end if
ThePage=session("CurrentPage")
if Obj_rd.recordcount<>0 then
Obj_rd.AbsolutePage=session("CurrentPage")
end if
%>

<% if session("CurrentPage")>1 then%>
<a href="index.asp?Page=1&colindex=<%=colindex%>&colname=<%=colname%>"><font color="E28B78">首页</font></a>  
<a href="index.asp?Page=<%=session("CurrentPage")-1%>&colindex=<%=colindex%>&colname=<%=colname%>">
<font color="E28B78">上一页</font></a>
<% else%>
首页  
上一页
<%end if%>
<% if (session("CurrentPage")<obj_rd.pagecount) then%>
<a href="index.asp?Page=<%=session("CurrentPage")+1%>&colindex=<%=colindex%>&colname=<%=colname%>"><font color="E28B78">下一页</font></a>   
<a href="index.asp?Page=<%=obj_rd.pagecount%>&colindex=<%=colindex%>&colname=<%=colname%>"><font color="E28B78">尾页</font></a>
<% else%>
下一页  尾页
HuaBin59 2006-11-21
  • 打赏
  • 举报
回复
那该怎么修改呢?
hbjmdx008 2006-11-21
  • 打赏
  • 举报
回复
很明显呀,
你的下一页文件联的不对呀。

<div align="center"><%
dim rs
dim id
id=Request.QueryString("id")
if isnumeric(id)=0 or id="" then
response.write "非法ID参数"
response.end
end if
set rs=server.createobject("adodb.recordset")
dim page,count
if trim(request.querystring("page"))="" or isnumeric(trim(request.querystring("page")))=false then
page=1
else
page=cint(trim(request.querystring("page")))
end if
rs.open "select * from jobs where jobareasid="&id&"",conn,1,1
if not (rs.bof and rs.eof) then
rs.pagesize = pagesize
if page<1 then
page=1
end if
if page>rs.pagecount then
page = rs.pagecount
end if
rs.absolutepage = page
for count = 1 to rs.pagesize
if rs.eof then
exit for
end if
%>
<table border="0" width="90%" cellspacing="0" cellpadding="0" id="table6" style="border-bottom: 1px dotted #C0C0C0">
<tr>
<td>
<div align="center">
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table7">
<tr valign=top>
<td width="20%">
<p align="center">
<img border="0" src="images/hot.jpg" width="50" height="46"><br>
<font color="#FF9900" face="黑体" size="4">
<%=rs("jobhot")%></font><font size="2">人关注</font></td>
<td width="80%">
<p style="line-height: 150%; margin-left: 20px; margin-right: 10px">
<a href="workread.asp?id=<%=rs("jobid")%>">
<font color="#000000"><b><%=rs("jobtitle")%></b></font></a><br>
<%=left(rs("jobdiscrabe"),60)%><br><br><a href="workread.asp?id=<%=rs("jobid")%>">
<font size="2" color="#000000">阅读全部内容...</b></font></a><br></td>
</tr>
</table>
</div><br>
</td>
</tr>
</table>
<p align="center"><b><%
rs.movenext
next
if page>1 then
%></b><a href="workclass.asp?id=<%=jobareasid%>&page=1"><font size="4" color="#993300"><span style="text-decoration: none">首页</span></font></a><font size="4"><font color="#993300"> </font><a href="workclass.asp?id=<%=jobareasid%>&page=<%=page-1%>"><font color="#993300"><span style="text-decoration: none">上一页</span></font></a><font color="#993300"> <%
else
%><%
end if
if page > 1 then
%><%
end if
for count=page-0 to page+0
if count>=1 and count<=rs.pagecount then
if count=page then
%><%
else
%><%
end if
end if
next
if page<rs.pagecount-5 then
%><%
end if
if page < rs.pagecount then
%></font><a href="workclass.asp?id=<%=jobareasid%>&page=<%=page+1%>"><font color="#993300"><span style="text-decoration: none">下一页</span></font></a><font color="#993300"> </font><a href="workclass.asp?id=<%=jobareasid%>&page=<%=rs.pagecount%>"><font color="#993300"><span style="text-decoration: none">尾页</span></font></a><b><font color="#3399FF"><%
else
%><%
end if
end if
rs.close
%>
<div align="center">
<table border="0" width="90%" cellspacing="0" cellpadding="0" id="table8">
<tr>
<td>
</td>
</tr>
</table>
</div>
</div>

28,408

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧