标题:分页显示求助
只看楼主
lyf
Rank: 1
等 级:新手上路
帖 子:238
专家分:0
注 册:2005-11-17
得分:0 
楼主即酷酷的鱼你试了可以吗?谢谢!

2005-12-09 11:13
酷酷的鱼
Rank: 1
等 级:新手上路
威 望:1
帖 子:472
专家分:0
注 册:2005-8-9
得分:0 
还没有,我试试,好了给大家说一声

2005-12-09 14:01
酷酷的鱼
Rank: 1
等 级:新手上路
威 望:1
帖 子:472
专家分:0
注 册:2005-8-9
得分:0 
<%
conbbs.Close
con.Close
rsAREAL.Close
Set con=Nothing
Set rsAREAL=Nothing
Set conbbs=Nothing
Set LMA=Nothing %>
这点也要换成
引用的这页面中用Set …=Server.CreateObject("ADODB.Connection")打开的Connection对象

2005-12-09 14:13
酷酷的鱼
Rank: 1
等 级:新手上路
威 望:1
帖 子:472
专家分:0
注 册:2005-8-9
得分:0 

还是不行

[此贴子已经被作者于2005-12-9 14:21:31编辑过]


2005-12-09 14:19
酷酷的鱼
Rank: 1
等 级:新手上路
威 望:1
帖 子:472
专家分:0
注 册:2005-8-9
得分:0 

<!--#include file="../include/opendb.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
'声明数据库记录集对象
Dim rsAREAL
'创建数据库记录集对象
Set rsAREAL=Server.CreateObject("ADODB.Recordset")
'设定数据库记录集游标类型
rsAREAL.cursortype=3
'打开记录集对象
rsAREAL.Open "SELECT newid,bt,time2 FROM xwtp where leibie='外埠新闻' ORDER BY newid desc",Connection
'设定每页显示记录数
rsAREAL.pagesize=4
'得到请求的页号
page=1
IF request("page")<>"" then
page=clng(request("page"))
Else
page=1
End IF
IF page<1 Then page=1
If page>rsAREAL.pagecount Then page=rsAREAL.pagecount
rsAREAL.absolutepage=page
%>
<title>-版块列表</title>
<style type="text/css">
<!--
<%=LMA.CSSCode%>
.style1 {font-size: 14px}
.style2 {font-size: 12px}
-->
</style>
<%=LMA.JavaScript%>
</head>

<body>

<table width="400" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="15" colspan="3" valign="top"><p align="right" class="style2">共<%=rsAREAL.pagecount%>页 当前第<%=page%>页 分页:<a href="AREAList.asp?page=1&PageP=10" title="第一页" target="_self"><font face=webdings>9</font></a>
<%
Dim PageP
Dim fp
'stop
IF page<>1 Then
IF Request("PageP")="" Then
Response.Write "<a href=AREAList.asp?page="&(page-1)&"&PageP="&(page+9)&" title=上一页 target=_self><font face=webdings>7</font></A>"
Else
PageP=Clng(Request("PageP"))
IF page>=PageP Then
Response.Write "<a href=AREAList.asp?page="&(page-1)&"&PageP="&(page+9)&" title=上一页 target=_self><font face=webdings>7</font></A>"
Else
IF page=(PageP-10) Then
Response.Write "<a href=AREAList.asp?page="&(page-1)&"&PageP="&(PageP-9)&" title=上一页 target=_self><font face=webdings>7</font></A>"
PageP=PageP-9
Else
Response.Write "<a href=AREAList.asp?page="&(page-1)&"&PageP="&PageP&" title=上一页 target=_self><font face=webdings>7</font></A>"
End IF
End IF
End IF
Else
Response.Write "<font face=webdings>7</font>"
End IF
IF Request("PageP")="" Then
For fp=page To (page+9)
IF fp<rsAREAL.pagecount Then
Response.Write "<a href=AREAList.asp?page="&CStr(fp)&"&PageP="&CStr(page+9)&" target=_self>"&CStr(fp)&"</a> "
End IF
Next
Else
'PageP=Clng(Request("PageP"))
IF page>=PageP Then
For fp=page To page+9
IF fp<rsAREAL.pagecount Then
Response.Write "<a href=AREAList.asp?page="&CStr(fp)&"&PageP="&CStr(page+9)&" target=_self>"&CStr(fp)&"</a> "
End IF
Next
'Response.Write "PD"
Else
IF page=(PageP-9) Then
IF page<>1 Then
For fp=(page-9) To (page-9)+9
IF fp<rsAREAL.pagecount Then
Response.Write "<a href=AREAList.asp?page="&CStr(fp)&"&PageP="&CStr((page-9)+9)&" target=_self>"&CStr(fp)&"</a> "
End IF
Next
Else
For fp=1 To 1+9
IF fp<rsAREAL.pagecount Then
Response.Write "<a href=AREAList.asp?page="&CStr(fp)&"&PageP="&CStr(1+9)&" target=_self>"&CStr(fp)&"</a> "
End IF
Next
End IF
Else
For fp=(PageP-9) To (PageP-9)+9
IF fp<rsAREAL.pagecount Then
Response.Write "<a href=AREAList.asp?page="&CStr(fp)&"&PageP="&CStr(PageP)&" target=_self>"&CStr(fp)&"</a> "
End IF
Next
End IF
'Response.Write "PF"&CStr((PageP-9)+9)&","&CStr(PageP-9)
End IF
End IF
IF page<>rsAREAL.pagecount Then
IF Request("PageP")="" Then
Response.Write "<a href=AREAList.asp?page="&(page+1)&"&PageP="&(page+9)&" title=下一页 target=_self><font face=webdings>8</font></A>"
Else
IF page>=PageP Then
Response.Write "<a href=AREAList.asp?page="&(page+1)&"&PageP="&(page+9)&" title=下一页 target=_self><font face=webdings>8</font></A>"
Else
Response.Write "<a href=AREAList.asp?page="&(page+1)&"&PageP="&Request("PageP")&" title=下一页 target=_self><font face=webdings>8</font></A>"
End IF
End IF
Else
Response.Write "<font face=webdings>8</font>"
End IF
%>
<a href="AREAList.asp?page=<%=rsAREAL.pagecount%>&PageP=<%=(rsAREAL.pagecount+3)%>" title="最后一页" target="_self"><font face=webdings>:</font></a></p> </td>
</tr>

</body>
<%
Connection.Close
conn.Close
rsAREAL.Close
Set conn=Nothing
Set rsAREAL=Nothing
Set Connection=Nothing
Set LMA=Nothing %>
<table width="398" border="0" cellpadding="0" cellspacing="0">
<tr>
<td> <table width="399" border="0" align="left" cellpadding="0" cellspacing="0">
<% do while not rsAREAL.eof and i<rsAREAL.pagesize
Set timew = rsAREAL("time2")%>
<tr>
<td width="10"><img src="shou/shou/shou51.JPG" width="6" height="7"></td>
<td width="389" align="left" ><span class=title04><a href="../xw/imagesnew.asp?id=<%=rsAREAL("newid")%>" target="_blank"><%=mid(rsAREAL("bt"),1,30)%></a>&nbsp;
<%=timew%></span></td>
</tr>
<%
i=i+1
rsAREAL.movenext
loop


end if
%>
</table>
</table>
Set LMAF=Nothing
%>
</html>


2005-12-09 14:22
酷酷的鱼
Rank: 1
等 级:新手上路
威 望:1
帖 子:472
专家分:0
注 册:2005-8-9
得分:0 

上面是我按照yms123的提示,进行修改的,还是不行,运行后为:

无法显示网页

您要访问的网页有问题,无法显示。

[此贴子已经被作者于2005-12-9 14:23:53编辑过]


2005-12-09 14:23
wptys
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2005-11-29
得分:0 
<%Set rs = Server.CreateObject("ADODB.Recordset")
sql = "SELECT top 100 * FROM gs ORDER BY id desc"
rs.open sql,conn,1,1
if rs.eof or rs.bof then
response.write "<tr><td align='center'>暂时没有</td></tr>"
else
page=request.QueryString("page")
rs.pagesize=80
total=rs.recordcount
if Not IsEmpty(trim(Request("Page"))) then
page = CInt(Request("page"))
if page > rs.PageCount then
rs.AbsolutePage = rs.PageCount
elseif page <= 0 then
page = 1
else
rs.AbsolutePage = page
end if
End if
page = rs.AbsolutePage
do while n<rs.pagesize and NOT rs.EOF%>
<tr><%for i=1 to 4%>
<td width='25%' align=center height=22 background=111.files/newsbg.gif>
<A href="zjss.asp?gs=<%=rs("name")%>"><%=rs("name")%></a>
</td>
<%
rs.movenext
if rs.eof then exit for
next
%>
</tr>
<%loop
end if%>
<tr><td colspan=4 height=40></td></tr>
<tr><td colspan=4 height=22 background=111.files/newsbg.gif align=center> 第<%=page%>/<%=rs.PageCount%>页</font>
<%
if rs.PageCount <= 6 then
for j=1 to rs.PageCount
response.write "[<a href='gsjs.asp?page="&j&"'>"&j&"</a>]"
next
elseif page<=6 then
response.write "[<a href='gsjs.asp?page=1'>&lt;&lt;</a>]"
for j=1 to 7
response.write "[<a href='gsjs.asp?page="&j&"'>"&j&"</a>]&nbsp;"
next
response.write "[<a href='gsjs.asp?page="&rs.PageCount&"'>&gt;&gt;</a>]"
elseif page>6 and page<rs.PageCount-3 then
response.write "[<a href='gsjs.asp?page=1'>&lt;&lt;</a>]"
for j=page-3 to page+3
response.write "[<a href='gsjs.asp?page="&j&"'>"&j&"</a>]&nbsp;"
next
response.write "[<a href='gsjs.asp?page="&rs.PageCount&"'>&gt;&gt;</a>]"
elseif page>rs.PageCount-3 then
response.write "[<a href='gsjs.asp?page=1'>&lt;&lt;</a>]"
for j=page-3 to rs.PageCount
response.write "[<a href='gsjs.asp?page="&j&"'>"&j&"</a>]&nbsp;"
next
response.write "[<a href='gsjs.asp?page="&rs.PageCount&"'>&gt;&gt;</a>]"
end if
rs.Close
set rs=nothing%>
</td></tr>

[此贴子已经被作者于2005-12-9 17:04:19编辑过]

2005-12-09 17:02
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 
Set LMAF=Nothing
和Set LMA=Nothing这两个删掉再试,不行的话。把错误页面的文字全贴上来。
2005-12-09 17:04
caiyakang
Rank: 2
等 级:新手上路
威 望:5
帖 子:2111
专家分:0
注 册:2005-3-24
得分:0 
以下是引用yms123在2005-12-8 22:44:00的发言:
最近准备自己写一个分页类。

写出来发出来看看


中国人的财富网:http://www..cn/
2005-12-09 17:34
aolong
Rank: 1
等 级:新手上路
帖 子:248
专家分:0
注 册:2005-10-11
得分:0 

做的真的很不错哎


奋斗之中,朦胧有你,一切已变的那么飘渺虚无...
2005-12-09 21:52



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-36886-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.343474 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved