200大富翁元问关于asp中分页显示的问题? (200分)

  • 主题发起人 主题发起人 英国病人
  • 开始时间 开始时间

英国病人

Unregistered / Unconfirmed
GUEST, unregistred user!
有数十万条数据,无法用recorder,想用别的方法,越详细越好,谢谢
不够可以加“钱”,呵呵
 
recorder是啥玩意儿?
 
例如:要取得第20页的数据
设定每页20条记录,那么应该取得的记录为381-400
select top 400
然后move到381,把这20条记录显示出来
如果嫌效率低,可以写成存储过程,减少从服务器返回的记录数(仅仅返回需要的20条记录)
如果还嫌效率低,我就不知道了
 

<%
response.buffer=false
Set Conn=Server.CreateObject("ADODB.Connection")
Connstr="DBQ="+server.mappath("ha315bbs.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;ImplicitCommitSync=Yes;MaxBufferSize=512;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UserCommitSync=Yes;"
Conn.Open connstr
%>
<html>
<head>
<title></title>
<link rel="stylesheet" href="/style1.css" type="text/css">
</head>
<body bgcolor="#CCFFFF" link="#000080" vlink="#008080" >
<table width="740" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="3">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="68%">红盾信息网 http://www.ha315.gov.cn </td>
<td width="32%">
<div align="right">
<script language=JavaScript>
<!--
now=new Date();
thisMonth=now.getMonth()+1;
thisYear=now.getYear();
do
cument.write(thisYear+"年"+thisMonth+"月"+now.getDate()+"日")
if(now.getDay()==0){var thisDay="日";}
if(now.getDay()==1){var thisDay="一";}
if(now.getDay()==2){var thisDay="二";}
if(now.getDay()==3){var thisDay="三";}
if(now.getDay()==4){var thisDay="四";}
if(now.getDay()==5){var thisDay="五";}
if(now.getDay()==6){var thisDay="六";}
do
cument.write(" 星期"+thisDay)
// -->
</script>
</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3">
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#0000CC">
<tr>
<td width="12" bgcolor="#0066CC">
<div align="right"><img src="/images/navbar-2.gif" width="662" height="20" usemap="#Map2Map" border="0"></div>
</td>
</tr>
</table>
<map name="Map2Map">
<area shape="rect" coords="0,1,54,19" href="/">
<area shape="rect" coords="56,2,110,18" href="/gsgk">
<area shape="rect" coords="112,2,164,18" href="/bszn">
<area shape="rect" coords="166,2,218,18" href="/flfg">
<area shape="rect" coords="221,3,277,20" href="/gsxx">
<area shape="rect" coords="277,1,331,18" href="/gsgg">
<area shape="rect" coords="331,2,383,20" href="/tt315">
<area shape="rect" coords="386,2,440,18" href="/zxfw">
<area shape="rect" coords="442,1,495,19" href="/qyzc">
<area shape="rect" coords="496,2,550,19" href="/wsts">
<area shape="rect" coords="553,2,605,20" href="/bbs">
<area shape="rect" coords="608,2,657,18" href="/guest">
</map>
</td>
</tr>
</table>
<table align=center border=0 cellpadding=0 cellspacing=0 height=20
width=740>
<tr>
<td width=100% align="left" bgcolor="#0066CC"><font color="#FFFF33">你所在的位置</font>
<!--导航条开始-->
<a href="/">主页</a>&amp;gt;&amp;gt;
<font color="#FF3333"> 工商论坛
<!--版块短标题-->
</font>
<!--导航条结束-->
</td>
</tr>
</table>
<br>
<table width="340" border="0" cellspacing="0" cellpadding="0" align="right">
<tr align="center">
<td width="138" height="20" nowrap><font color="#CCFFFF"><a href="item1.asp?No=<%Response.Write Request("No")%>">我要发言</a></font></td>
<td width="83" height="20" nowrap><font color="#CCFFFF"><a href="quit.asp?No=<%Response.Write Request("No")%>">离开论坛</a></font></td>
<td width="113" height="20" nowrap><font color="#CCFFFF"><a href="login.asp">管理员入口</a></font></td>
</tr>
</table>

<p>&amp;nbsp;</p>
<p><%
sql="SELECT * FROM info WHERE forder=1 ORDER BY ID DESC"
dim rootRs
Set rootRs=Server.CreateObject("ADODB.RecordSet")
rootRs.Open sql,conn,1
If rootRs.Bof OR rootRs.Eof then
%>
<script language=javascript>
<!--
if (!confirm("目前还没有发言内容。想发言吗?"))
window.history.go(-1);
//-->
</script>
<%
else

set name1=rootrs("subject")
set name2=rootrs("username")
set name3=rootrs("recallnm")
set name4=rootrs("email")
set visicount=rootrs("visicount")
set Num=rootrs("Num")
rootRs.pagesize=10
rootRs.AbsolutePage =1
if Request("page")<>"" then
rootRs.AbsolutePage =Request("page")
RowCount =rootRs.pagesize
If Not rootRs.Eof then
%><br>
<table border="1" cellspacing="0" width="600" height="20"
bgcolor="#FFCCFF" cellpadding="4" align="center">
<tr bgcolor="#CCFFCC">
<td width="91" valign="middle">
<div align="center">
<p class="p4">作  者</p>
</div>
<td width="352" valign="middle">
<div align="center" class="p4">标     题 </div>
<td width="31" valign="middle" align="center">阅读人数
<td width="28" valign="middle" align="center">回复次数
</tr>
<%Do While Not rootRs.Eof AND RowCount>0%>
<tr>
<td width="91" valign="middle"><font color="#800000"><a href="mailto:<%Response.Write name4%>">
<%Response.Write Name2%>
</a></font>
<td width="352" valign="middle"><font color="#800000"> <a href="look2.asp?Num=<%Response.Write Num%>&amp;No=<%Response.Write Request("No")%>">
<%Response.Write Name1%>
</a> </font>
<td width="31" valign="middle" align="right">
<div align="right"><font color="#800000">
<%Response.Write visicount%>
</font> </div>
<td width="28" valign="middle" align="right">
<div align="right"><font color="#800000">
<%Response.Write Name3%>
</font> </div>
</tr>
<%
rootRs.MoveNext
RowCount=RowCount-1
Loop
End If
%>
</table>
<%
If rootRs.pagecount>1 then
%>
<p>&amp;nbsp;</p>
<table border=0 cellpadding="0" cellspacing="0" width="126" align="center">
<tr bgcolor="#FFFFCC">
<td nowrap>论题分页:</td>
<%
For i=1 to rootRs.pagecount
%>
<td nowrap bgcolor="#99FFFF"><a href='look.asp?page=<%= i%>&amp;No=<%= Request("No") %>'>
[<b> <%=i%> </b>]</a> </td>
<%
next
%>
</table>
<%
End if
End if
rootRs.close
Set rootRs=nothing
conn.close
Set conn=nothing
%>
<table width="740" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td bgcolor="#333399"><img src="/images/dot.gif" width="1" height="1"></td>
</tr>
<tr>
<td>
<table width="420" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="12%"><font color="#6699CC"><img name="hd" src="../images/hd.gif" width="54" height="60" border="0"></font></td>
<td width="88%">江苏省南通市海安工商行政管理局 - 海安红盾信息网 版权所有 <br>
  如果您对我们的网站有什么意见或者建议,请<a
href="mailto:webmaster@ha315.gov.cn">与我们联系</a>。 </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
 
不用recordset记录集方法能实现吗?
 
ht99的方法是惯用的方法啊!!!
 
同意左轻侯的看法:-)
 
既然已经声明不能用 Rs.AbsolutePage 等,就不能用 ht99 的方法而只能用左轻侯的方法,因为我以前也碰到类似的情况,是MYSQL数据库不支持。
 
记住每页最后一笔的ID:the_id,就可以这样:
比如每页20笔记录:select top 20 ... from ... where id> the_id order
by id
 
多人接受答案了。
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
2K
DelphiTeacher的专栏
D
I
回复
0
查看
855
import
I
后退
顶部