标题:[求助]查询出来的信息怎么分页显示出来
只看楼主
zk20716
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2005-5-17
 问题点数:0 回复次数:1 
[求助]查询出来的信息怎么分页显示出来
我查询出来的信息,可以分页显示,但是不能换页,请各位高手知道一下,代码如下

 <%
    if request.Form("submit2")="搜索" then
    select1 = request.QueryString("select1")
    select1 = request.Form("select1")
    txttitle = request.Form("txttitle")
   set rs = server.CreateObject("ADODB.Recordset")
   if request.Form("select1")="" and request.Form("txttitle")="" then
   rs.open "select  newid as 新闻ID ,newtitle as 新闻标题,newasstitle as 新闻副标题 ,newtime as 上传时间,newstpye as 新闻类型,newOfferMan as 上传人用户名 from TYnew  where newstart = '未审查'",cn,3,2
   rs.pagesize = 10
   page = clng(request("page"))
   if page < 1 then page = 1
   if page > rs.pagecount then page = rs.pagecount
%>
      </p>
      <table border="0"  height=50 align="center" class="txt_border" >
        <tr><td></td>
        <%for i = 0 to rs.fields.count-1
 'response.Write "<td>"&rs.fields(i).name&"</td>"
next%>
        </tr>
        <% rs.absolutepage = page
 for ipage =1 to rs.pagesize
 recno = (page-1) *rs.pagesize+ipage
%>
        <tr><td></td>
        <%for i = 0 to rs.fields.count-1%>
        <td><a href="updatenew.asp?newID=<%=rs.fields(0)%>&pagestart=1"> <%=rs.fields(i).value%></a> </td>
        <%next%>
        </tr>
        <%
 rs.movenext
 if rs.eof then exit for
 next
%>
      </table>     <span class="style31"> <p align="center">
          <%
 if page <>1 then
  response.Write "<a href = updatenew2.asp?page=1&selete1 ="&request.Form("select1")&">第一页</a>  "
  response.Write "<a href = updatenew2.asp?page=" & (page-1) & "&selete1 ="&request.Form("select1")&"> 上一页</a>  "
 end if
 if page <> rs.pagecount then
  response.Write "<a href = updatenew2.asp?page=" & (page+1) & "&selete1 ="&request.Form
("select1")&"> 下一页</a>  "
  response.Write "<a href = updatenew2.asp?page=" & rs.pagecount &"&selete1="&request.Form("select1")&">最后一页</a>"
 end if
%>
    </p>        <p align="center">页数:<%=page%>/<%=rs.pagecount%>
</p></span> <%end if%>
搜索更多相关主题的帖子: 查询 
2005-05-17 01:47
无根泉
Rank: 2
等 级:新手上路
威 望:4
帖 子:853
专家分:0
注 册:2004-11-4
得分:0 
以下是引用zk20716在2005-5-17 1:47:31的发言: 我查询出来的信息,可以分页显示,但是不能换页,请各位高手知道一下,代码如下 <% if request("submit2")="搜索" then select1 = request("select1") txttitle = request("txttitle") set rs = server.CreateObject("ADODB.Recordset") if request.Form("select1")="" and request.Form("txttitle")="" then rs.open "select newid as 新闻ID ,newtitle as 新闻标题,newasstitle as 新闻副标题 ,newtime as 上传时间,newstpye as 新闻类型,newOfferMan as 上传人用户名 from TYnew where newstart = '未审查'",cn,3,2 rs.pagesize = 10 page = clng(request("page")) if page < 1 then page = 1 if page > rs.pagecount then page = rs.pagecount %> </p> <table border="0" height=50 align="center" class="txt_border" > <tr><td></td> <%for i = 0 to rs.fields.count-1 'response.Write "<td>"&rs.fields(i).name&"</td>" next%> </tr> <% rs.absolutepage = page for ipage =1 to rs.pagesize recno = (page-1) *rs.pagesize+ipage %> <tr><td></td> <%for i = 0 to rs.fields.count-1%> <td><a href="updatenew.asp?newID=<%=rs.fields(0)%>&pagestart=1"> <%=rs.fields(i).value%></a> </td> <%next%> </tr> <% rs.movenext if rs.eof then exit for next %> </table> <span class="style31"> <p align="center"> <% if page <>1 then response.Write "<a href = updatenew2.asp?page=1&submit2="&submit2&"&selete1 ="&select1&"&txttitle = "&txttitle&">第一页</a>&nbsp;&nbsp;" response.Write "<a href = updatenew2.asp?page=" & (page-1) & &submit2="&submit2&"&selete1 ="&select1&"&txttitle = "&txttitle&"> 上一页</a>&nbsp;&nbsp;" end if if page <> rs.pagecount then response.Write "<a href = updatenew2.asp?page=" & (page+1) &&submit2="&submit2&"&selete1 ="&select1&"&txttitle = "&txttitle&"> 下一页</a>&nbsp;&nbsp;" response.Write "<a href = updatenew2.asp?page=" & rs.pagecount &"&submit2="&submit2&"&selete1 ="&select1&"&txttitle = "&txttitle&"最后一页</a>" end if %> </p> <p align="center">页数:<%=page%>/<%=rs.pagecount%> </p></span> <%end if%>
改成那样试试

我很菜,但我很努力!
2005-05-17 09:15



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




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

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