最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
ASP + Access2000 高效分页程序
时间:2022-07-02 23:10:06 编辑:袖梨 来源:一聚教程网
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
On Error Resume Next
dim startime,endtime
startime=timer()
'连接数据库
dim db,conn,rs
db = "provider=microsoft.jet.oledb.4.0;data source=" & server.mappath("./db.mdb")
set conn = server.createobject("adodb.connection")
set rs = server.createobject("adodb.recordset")
conn.open db
%>
<%
'**************
'分页导航栏函数
'输出wzpage值
'**************
Function pagination(pagecount)
Dim wzpage,wzpagecount,pagenum,boardid
boardid = Request.QueryString("board_id")
If boardid = 0 Then boardid = 1
If Len(Request.QueryString("page"))<>0 Then
wzpage = clng(Request.QueryString("page"))
Else
wzpage =1
End If
If wzpage <= 0 Then wzpage =1
pagenum = (wzpage 10)*10+1
If wzpage mod 10 = 0 Then pagenum = (wzpage 10)*10-9
If wzpage > 10 Then
Response.Write ("")
Response.Write ("9")
Response.Write ("7")
Response.Write ("")
End If
For pagenum = pagenum To pagenum + 9
If pagenum = wzpage Then
Response.Write ("")
Response.Write (" ["& pagenum &"] ")
Response.Write ("")
Else
Response.Write (" ")
Response.Write ("["& pagenum &"]")
Response.Write (" ")
End If
If pagenum >= pagecount Then Exit For
Next
If wzpage < (pagecount - (pagecount 10)) Then
Response.Write ("")
Response.Write ("8")
Response.Write (":")
Response.Write ("")
End If
End Function
%>
<%
dim rssql,getstring
getstring = clng(request.querystring("board_id"))
if getstring = 0 then getstring = 1
'******************************************
'取文章总数及每页重复显示条数,准备分页
'wzcount 文章总数
'wzrep 重复显示条数
'wzpage 分页参数id
'wzpagecount 总页数
'******************************************
dim wzcount,wzrep,wzpage,wzpagecount,wzpagerep,boardstr
wzrep = 30
'rssql = "select count(id) from `table1`"
'rs.open rssql,conn,0,1,&h0001
wzcount = conn.execute ("select count(id) from `table1`",0,1)(0)
'rs.close
wzpagecount = abs(int(-abs(wzcount/wzrep)))
wzpage = clng(request.querystring("page"))
if len(wzpage) = 0 or wzpage = 0 then wzpage = 1
%>
css" type="text/css">
ID | 标题 | 内容(显示前20个字) | 时间 |
暂无记录 | |||
<%=rs(0)%> | <%=rs(1)%> | <%=left(rs(2),20)%> | <%=rs(3)%> |
共<%= wzcount%>条 <%= wzrep%>/页 共<%= wzpagecount%>页 | <%= pagination(wzpagecount)%> |
<%endtime=timer()%> 本页面执行时间:<%=formatnumber((endtime-startime)*1000,3)%>毫秒 |
<%
'释放资源
rs.close
set rs = nothing
conn.close
set conn = nothing
%>