| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2660 人关注过本帖
标题:分页显示求助
取消只看楼主 加入收藏
酷酷的鱼
Rank: 1
等 级:新手上路
威 望:1
帖 子:472
专家分:0
注 册:2005-8-9
收藏
得分:0 
好,我试试,谢谢

2005-12-08 16:07
酷酷的鱼
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",conbbs
'设定每页显示记录数
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><%=LMA.Name%>-版块列表</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>
<%
conbbs.Close
con.Close
rsAREAL.Close
Set con=Nothing
Set rsAREAL=Nothing
Set conbbs=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-08 16:47
酷酷的鱼
Rank: 1
等 级:新手上路
威 望:1
帖 子:472
专家分:0
注 册:2005-8-9
收藏
得分:0 
好,谢谢yms123
我试试

2005-12-09 09:46
酷酷的鱼
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
快速回复:分页显示求助
数据加载中...
 
   



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

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