查询第一页正常,第二页以后显示全部记录
代码是网上下载的,按网上说的将值传过去,但改了半天也没成功,查询是从两个字段中查询出包含关键字的记录.
<% dim MaxPerPage
    dim sql  
    dim rs
    dim gstBookID
    dim totalPut    
    dim CurrentPage
    dim TotalPages
    dim i,j
    stj=trim(request("tj"))						
    skey=trim(request.form("key"))	  
       if not isempty(request("page")) then
       currentPage=cint(request("page"))
    else
       currentPage=1
    end if
set rs=server.createobject("adodb.recordset")
if stj=1 then
	sql="select * from ziliao where jh like '%"&skey&"%'  order by Scrq"
end if  
if stj=2 then
	sql="select * from ziliao where sgmd like '%"&skey&"%'  order by Scrq"
end if		
rs.open sql,conn,1,1
if rs.eof and rs.bof then %>  
<p align="center"> 还 没 有 任 何 资 料 </p>
<% else
    rs.pagesize=20
    totalPut=rs.recordcount '记录总数
    totalPage=rs.pagecount
    MaxPerPage=rs.pagesize
       if currentpage<1 then
           currentpage=1
       end if
       if currentpage>totalPage then
           currentpage=totalPage
       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               
       end if
    end if
       rs.close
end if
set rs=nothing   
conn.close
set conn=nothing   
sub showContent
     dim i
%>
.......
<%do while not (rs.eof or err)%>
........
<%  
   if i>=MaxPerPage then exit do '循环时如果到尾部则先退出,如果记录达到页最大显示数,也退出
   i=i+1
   rs.movenext
     loop
	dim n
n=totalPage
%>
<form Action="brow.asp" Method="GET" align="right">
   <div align="center"><center>
       <table border="0" width="600" cellspacing="0" cellpadding="0" height="30">
         <tr>
           <td width="100%" height="30">  
             <p align="center"><%  
    If currentPage <> 1 Then
       Response.Write "<A HREF=brow.asp>[第一页]</A> "
       Response.Write "<A HREF=brow.asp?Page=" & (currentPage-1) & ">[上一页]</A> "
    End If
    If currentPage <> rs.PageCount Then
       Response.Write "<A HREF=brow.asp?Page=" & (currentPage+1) & ">[下一页]</A> "
       Response.Write "<A HREF=brow.asp?Page=" & totalPage & ">[最后一页]</A> "
    End If
%> 第<font color="#FF0000"><%=currentPage%></font>页,共<font color="#FF0000"><%=totalPage%></font>页  
             <%   response.write " 转到:<select name='page' size=1 class=smallselsect style='BACKGROUND-COLOR:#FFE7B3;font-family: 宋体; font-size: 9pt;'>"
for i=1 to n
    response.write "<option value="&