紧急求助!我为什么不能翻页?

ruyunluck 2003-09-26 12:52:13

<%
const MaxPerPage=30
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim keyword
keyword=trim(request("keyword"))
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if


%>
<form method="post" action="searchbybanjianhao_USER_TYPE_ACCESS.asp" name=addbt3>

<table width="60%" border="0">
<tr>
<td width="44%">
按业务角色查询:<input class=TextBorder name=keyword >
</td>
</tr>
</table>
</form>
<div align="center"> <%
dim sql
dim rs
sql="select * from USER_TYPE_ACCESS where type='"&keyword&"' "

Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,cnn,1,1
if rs.eof and rs.bof then
response.write "<p align='center'> 还 没 有 任 何 资 料 !</p>"
else
totalPut=rs.recordcount
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if

end if
if currentPage=1 then
showpages
showContent
showpages
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpages
showContent
showpages
else
currentPage=1
showpages
showContent
showpages
end if
end if
rs.close
end if


set rs=nothing
cnn.close
set cnn=nothing

sub showContent
dim i
i=0

%>
<%do while not rs.eof%>
<td ><%=rs("type")%>
</td>
<td >
<%=rs("ACCESS_NAME")%>
</td>
<% i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
<%
end sub
sub showpages()
dim n
if (totalPut mod MaxPerPage)=0 then
n= totalPut \ MaxPerPage
else
n= totalPut \ MaxPerPage + 1
end if


dim k
response.write "分页 "
for k=1 to n
if k=currentPage then
response.write "[<b>"+Cstr(k)+"</b>] "
else
response.write "[<b>"+"<a href='searchbybanjianhao_USER_TYPE_ACCESS.asp?page="+cstr(k)+"&type="&keyword&"'>"+Cstr(k)+"</a></b>] " //执行这里时候出错
end if
next
response.write " <a href=database_manage.asp style='TEXT-DECORATION: underline'><font color=red>到管理员首页</font></a>"
response.write "</p>"
end sub
%>
</body>

比如当我查询的条件是:type=9的时候
运行时候显示如下:
共39项资料 分页 [1] [2] 到管理员首页
第一页的数据能正常显示出来。
当我按下[2] 时候应当显示出数据,但是却显示:
还 没 有 任 何 资 料 !

当我按下[2] 时:地址为:
http://..../searchbybanjianhao_USER_TYPE_ACCESS.asp?page=2&type=9


...全文
88 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
不老书生 2003-09-26
  • 打赏
  • 举报
回复
喂,应该是


keyword=trim(request("type"))
ruyunluck 2003-09-26
  • 打赏
  • 举报
回复
keyword这个参数有。
我就是想改这一句,可不知道该怎么改?
response.write "[<b>"+"<a href='searchbybanjianhao_USER_TYPE_ACCESS.asp?page="+cstr(k)+"&keyword="&keyword&"'>"+Cstr(k)+"</a></b>] "

avonqin 2003-09-26
  • 打赏
  • 举报
回复
对,把
type="&keyword&"
改为
keyword="&keyword&
Brookes 2003-09-26
  • 打赏
  • 举报
回复
http://..../searchbybanjianhao_USER_TYPE_ACCESS.asp?page=2&type=9


keyword=trim(request("keyword"))
sql="select * from USER_TYPE_ACCESS where type='"&keyword&"' "
看看有keyword参数吗?

response.write "[<b>"+"<a href='searchbybanjianhao_USER_TYPE_ACCESS.asp?page="+cstr(k)+"&keyword="&keyword&"'>"+Cstr(k)+"</a></b>] " //执行这里时候出错
~~~~~~~~修改这里!

28,406

社区成员

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

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