救急! 给一个查询页加上分页功能 在线等
access数据库 数据库文件名111.mdb 表名work 里面有两个字段account和tel
这页是查询显示,我想加入分页功能,如“当前第X页 共X页 共X条记录 上一页 下一页”
下面是asp页面的代码
弄了半天 一直没弄好 请救救急 在我的这页上加上分页功能 谢谢!
<html>
<head>
<title> </title>
</head>
<body>
<TABLE>
<TR> <TD>
<%
set conn=server.createobject( "adodb.connection ")
connstr= "driver={microsoft access driver (*.mdb)};dbq= "&server.mappath( "111.mdb ")
conn.open connstr
set rs=server.createobject( "adodb.recordset ")
sql= "select * from work order by id desc "
rs.open sql,conn,1,1
if rs.eof and rs.bof then
%> 目前没有任何记录 <%else%> <%do while not rs.eof%>
<%=rs( "account ")%> || <%=rs( "tel ")%>
<br>
<%
rs.movenext
loop
end if
rs.close
%>
</TD> </TR> </table>
</body>
</html>
------解决方案-------------------- <!--#include file= "conn.asp "-->
<html>
<head>
<meta http-equiv= "Content-Language " content= "zh-cn ">
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
<meta name= "GENERATOR " content= "Microsoft FrontPage 5.0 ">
<meta name= "ProgId " content= "FrontPage.Editor.Document ">
<link rel= "stylesheet " type= "text/css " href= "css/css.css ">
<title> xxxxx </title>
</head>
<body leftmargin= "0 " topmargin= "0 ">
<%
MaxPerPage=20
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim typename
typename= " "
if not isempty(request( "page ")) then
currentPage=cint(request( "page "))
else
currentPage=1
end if
dim sql
dim rs
dim rstype
dim typesql
dim typeid,typename1
if not isEmpty(request( "typeid ")) then
typeid=request( "typeid ")
else
typeid=0
end if
%>
<table border= "0 " width= "100% " cellspacing= "0 " cellpadding= "0 ">
<tr>
<td width= "100% "> </td>
</tr>
</table>
<%
sql= "select * from work order by id desc "
Set rs= Server.CreateObject( "ADODB.Recordset ")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write " <p align= 'center '> 还 没 有 记 录 </p> "
else
totalPut=rs.recordcount
totalPut=rs.recordcount
if currentpage <1 then
currentpage=1
end if