各位高手也帮我看看吧
<% dim SQL on error resume next set Conn=Server.CreateObject("ADODB.Connection") PS="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="_ & Server.MapPath(" jsj.mdb ") Conn.open PS
%> <HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=gb2312"> <TITLE>计算机设备一览表</TITLE> <STYLE type="text/css"> BODY{FONT-SIZE:12px} TH{FONT-SIZE:12px} TD{FONT-SIZE:12px} </STYLE>
<% if not isempty(request("page")) and request("page")<>"" then currentPage=cint(request("page")) else currentPage=1 end if MaxPerPage=5'###每页显示条数
if request.servervariables("REQUEST_METHOD")="POST" then else end if set rs = Server.CreateObject("ADODB.Recordset") sql="select * from equ"
rs.Open Sql,conn,3
if not rs.eof then rs.pagesize=MaxPerPage '得到每页数 mpage=rs.pagecount '得到总页数 totalPut=rs.recordcount if currentpage<1 then currentpage=1 end if rs.move (currentPage-1)*MaxPerPage end if %> </head>
<div align="center"><center> <TABLE Border=0 width="100%">
<td colspan=24> <H5 ALIGN=CENTER><font size=4>计算机设备一览表</font></H5>
</table> <table border="1" cellspacing="0" topspacing="0" cellpadding="0" bgcolor="#7AABA6"> <tr> <%
Set Columns=rs.Fields %>
<% For i=0 to Columns.Count-1 Response.Write("<td align=center width=200 height=13>") Response.Write("<font size=1><b>"&Columns(i).name&"</b></font></td>") Next Response.Write("</tr>") ''显示内容 For i=1 to rs.PageSize Response.Write("<tr bgcolor=#99ccff bordercolor=#000066>") For j=0 to Columns.Count-1 Response.Write("<td><font size=1>"&Columns(j)&"</font></td>") Next Response.Write("</tr>") rs.movenext if rs.EOF then exit for Next
%> </td> </table> <table border="0" width="100%" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bgcolor="#FFE3A5"> <tr> <td width="5" nowrap> </td> <td nowrap>总数:<font color="#ff0000"><%=rs.recordcount%> </font> 每页<%=MaxPerPage%>条 共<%=mpage%>页[<a href="javaScript:history.go(0)">刷新</a>]</td> <td width="70%" nowrap> <p align="center"><% pageno=currentPage %> <%if cint(pageno)>1 then%> <a href="equ.asp?page=1" title="最前页"><%end if%> <font face="Webdings">9</font></a> <%if cint(pageno)>1 then%> <a href="equ.asp?page=<%=pageno-1%>" title="上一页"><%end if%> <font face="Webdings">7</font></a><% pp=cint(pageno)-5 if pp<1 then pp=1 end if for pno=pp to mpage p=p+1 if pno*1=cint(pageno)*1 then %> <font color="#FF0000">[<%=pno%> ]</font><%else%> <a href="equ.asp?page=<%=pno%>">[<%=pno%> ]</a><%end if%> <% if p>=11 then exit for next%> <%if cint(pageno)< mpage then%> <a href="equ.asp?page=<%=pageno+1%>" title="下一页"><%end if%> <font face="Webdings">8</font></a> <%if cint(pageno)< mpage then%> <a href="equ.asp?page=<%=mpage%>" title="最后页"><%end if%> <font face="Webdings">:</font></a></p> </td> <td width="1%" nowrap> <table cellpadding="0" cellspacing="0"> <form method="POST" action="equ.asp"> <tr> <td nowrap>到<input name="page" size="2" style="border: 1px solid #000000">页</td> <td vAlign="bottom"><input align="center" name="Submit2" src="goto.gif" type="image" value="Submit"></td> </tr> </form> </table> </td> </tr> </table> <% rs.close set rs=nothing conn.close set conn=nothing%>
[此贴子已经被作者于2004-09-11 15:02:41编辑过]