| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 502 人关注过本帖
标题:[求助]查询出来的信息怎么分页显示出来
只看楼主 加入收藏
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
快速回复:[求助]查询出来的信息怎么分页显示出来
数据加载中...
 
   



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

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