七彩课堂[网页设计知识系列]
最快的ASP分页方式
五十万条记录访问速度平均:70毫秒 顺序访问
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
time1=timer
Set con=Server.CreateObject("adodb.Connection")
constr="provider=Microsoft.jet.oledb.4.0;data source="&Server.Mappath("/database/test.mdb")&";"
con.open constr
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>七彩空间:分页显示方式</title>
<style type="text/css">
<!--
table {
font-size: 9pt;
color: #333333;
}
-->
</style>
</head>
<body>
<table width="500" border="1" cellpadding="4" cellspacing="2">
<tr>
<td width="169">id</td>
<td width="309">七彩课堂</td>
</tr>
<%
count=1
pSize=20
id=Request("id")
if Request.QueryString("count")<>"" then
count=Clng(Request.QueryString("count"))
if count<1 then
count=1
end if
end if
if count=1 then
SQL="select top 20 id , pro_name from product"
else
SQL="Select id,pro_name from product"
end if
Set rs=Server.CreateObject("ADODB.RecordSet")
rs.Open SQL,con,1,1
rs.move (count-1)*20
for i=0 to 19
%>
<tr>
<td><%=rs("id")%></td>
<td><%=rs("pro_name")%></td>
</tr>
<%
id=rs("id")
rs.movenext
next
%>
<tr>
<td colspan="2" align="right"><a href="javascript:history.go(-1)">上一页</a> <a href="fy.asp?count=<%=count+1%>&id=<%=id%>">下一页</a></td>
</tr>
</table>
<%rs.close
Set rs=nothing%>
</body>
</html>
<%
con.Close
Set con=nothing
time2=timer
Response.Write((time2-time1)*1000)
%>

发表时间:2006-01-27
 
信息推荐
资讯中心 | 电子商务 | 搜索营销 | 设计学院 | 中医养生 | 养生保健 | 节日祝福 | 民俗文化 | 奇闻趣事
建站知识 | 人世百态 | 网站导航 | 传统节日 | 搜索热点 | 星座运势 | 趣闻轶事 | 祝福的话 | 短信大全
© 2023 QicaiSpace.Com