标题:显示新闻标题列表的问题~毕业设计急需!!!!!!
取消只看楼主
wyang8574
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2008-6-6
 问题点数:0 回复次数:0 
显示新闻标题列表的问题~毕业设计急需!!!!!!
想做个显示新闻标题的列表,每行标题后面有“查看”和“删除”两个选项,设置为每页显示10条
但运行后发现数据表中的20条数据全显示在了第一页上,而第二页则显示的后10条数据,看了下代码也没发现什么错误,小弟菜鸟,请各位大侠指点迷津...谢谢!!!!!!!!

具体代码如下:

<tr>
     <td width="538" height="370" colspan="2" align="center" valign="top">
       <%
         dim sql,rs
         Set conn = Server.CreateObject("ADODB.Connection")
         conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db.mdb")
         set rs=server.CreateObject("adodb.recordset")
         sql="select * from news  order by date desc"
         rs.open sql,conn,1,1
         if rs.eof and rs.bof then
         response.Write"目前没有记录"
         response.end
         else
         rs.pagesize=10
         page=request.QueryString("page")
         if not isnumeric(page) then page=1
         if isempty(page) or cint(page)<1 then page=1
         if cint(page)>rs.pagecount then page=rs.pagecount
         end if
         rs.absolutepage=page
       %>
      <%
        for i=1 to rs.recordcount
       %>
       <table width="500" height="30" border="0" cellpadding="0" cellspacing="0">
          <tr>
             <td width="340" height="30" align="left" valign="middle" class="STYLE9">
               <%=rs("title")%>
                 </td>
             <td width="20" align="left" valign="middle" class="STYLE9">
                </td>
             <td width="70" height="30" align="center" valign="middle">
                <a href="<%=rs("content")%>  class=" class="STYLE9"" >查看 </a>
                   </td>
              <td width="70" height="30" align="center" valign="middle">
                 <a href="admin_newsdelete.asp?id=<%=rs("id")%>" class="class="STYLE9">
                    删除
                    </a>   
                 </td>
             </tr>
          <%
              rs.movenext
              if rs.eof then exit for
              next
             %>
           </table>
    </td>
 </tr>
        
<tr>
      <td width="538" height="50" colspan="2" align="center" valign="middle">
        <p align="center">
          <a href="admin_news.asp?page=1">首页</a> 
          <a href="admin_news.asp?page=<%=page-1%>">上一页</a> 
          <a href="admin_news.asp?page=<%=page+1%>">下一页</a> 
          <a href="admin_news.asp?page=<%=rs.pagecount%>">最后页</a>
          </p>
        <p align="center">现在是第<%=page%>页一共有<%=rs.pagecount%>页</p>
        <%
            conn.close()
         %>
       </td>
</tr>
搜索更多相关主题的帖子: 新闻标题 毕业设计 列表 数据 
2008-06-07 16:47



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




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

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