一种比较方便的ASP分页程序
2008-02-23 05:31:43来源:互联网 阅读 ()
<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 p*10>0 then response.write "<a href=index.asp?page="&p*10&" title=上十页><font face=webdings>7</font></a>"
response.write "<b>"
for ii=p*10 1 to P*10 10
if ii=requestpage then
response.write "<font color=""#FF0000"">"&ii&"</font> "
else
response.write "<a href=index.asp?page="&ii&">"&ii&"</a> "
end if
if ii=maxpage then exit for
next
response.write "</b>"
if ii<maxpage then response.write "<a href=index.asp?page="&ii&" title=下十页><font face=webdings>8</font></a>"
if requestpage=maxpage then
response.write "<font face=webdings color=""#FF0000"">:</font> "
else
response.write "<a href=index.asp?page="&maxpage&" title=尾页><font face=webdings>:</font></a>"
end if
response.write" 总共有"&maxpage&"页 共"&totalrecord&"个记录 每页"&shownum&"个"
end if
%>
</span></td>
</tr>
</TABLE>
<span class="style45">
<%
rs.close
set rs = nothing
conn.close
set conn = nothing
%>
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash