比較方便的ASP分頁程式

來源:互聯網
上載者:User
比較|程式|分頁|分頁 <span class="style45">
  <%
set conn=server.createobject("adodb.connection")
DBPath = Server.MapPath("sap_mis.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath

set rs = server.createobject("adodb.recordset")
sql = "select sap_adon_record.* from sap_adon_record order by s_id desc"
rs.open sql, conn, 1, 1
%>
  </span>
  <table width="98%" height="10" border="1" align="center" cellpadding="0" cellspacing="0"  bordercolor="#336699" bordercolordark="#FFFFFF" class="style45" > 

<%if rs.EOF then%>
                <tr>
                    <td align="center"><span style="color: #339933"><a href="add.asp">系統中暫時沒有記錄,請點擊此處添加!</a></span>
                    </td>
                </tr>
<%else%>
  <tr>
      <td align="center" bgcolor="#f000ff" class="style45">111</td>
      <td align="center" bgcolor="#f000ff" class="style45">222</td>
      <td align="center" bgcolor="#f000ff" class="style45">333</td>
      <td align="center" bgcolor="#f000ff" class="style45">444</td>
      <td align="center" bgcolor="#f000ff" class="style45">555</td>
      <td align="center" bgcolor="#f000ff" class="style45">666</td>
      <td align="center" bgcolor="#f000ff" class="style45">777</td>
  </tr>
<%
shownum=20
totalrecord=rs.recordcount
rs.pagesize=shownum
maxpage=rs.pagecount

requestpage=clng(request.querystring("page"))

if requestpage="" or requestpage=0 then
   requestpage=1
end if
if resquestpage>maxpage then
    resquestpage=maxpage
end if

if not requestpage=1 then
rs.move (requestpage-1)*rs.pagesize
end if
for i=1 to rs.pagesize and not rs.bof%> 
  <tr>
      <td align="center" class="style45"><a href='show.asp?s_id=<%=rs("s_id")%>' target="_blank"><%=rs("prname")%></a></td>
      <td align="center" class="style45"><%=rs("trscod")%></td>
      <td align="center" class="style45"><%=rs("crname")%></td>
      <td align="center" class="style45"><%=rs("crdate")%></td>
      <td align="center" class="style45"><%=rs("prtype")%></td>
      <td align="center" class="style45"><%=rs("fction")%></td>
      <td align="center" class="style45"><a href='edit.asp?s_id=<%=rs("s_id")%>'>編輯</a></td>
  </tr>
<%
rs.movenext
if rs.eof then exit for
next
%>
</table>
<table width="98%" height="10" align="center"  border="1"  bordercolor="#336699" bordercolordark="#FFFFFF" cellpadding="0" cellspacing="0" > 
                <tr>
                    <td align="center" class="style45"><a href=add.asp>添加記錄</a>   |   <a href=readExcel.asp target="_self">EXCEL檔案大量匯入</a>   |    <a href=srch.asp>進階查詢</a>
                    </td>
                </tr>
   <tr>
     <td align=center>
       <span class="style45">
       <%
if requestpage-1 mod 10=0 then
 p=(requestpage-1) \ 10
else
 p=(requestpage-1) \ 10
end if
if requestpage=1 then
 response.write "<font face=webdings color=""#FF0000"">9</font>"
else
 response.write "<a href=index.asp?page=1 title=首頁><font face=webdings>9</font></a>"
end if
if



相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.