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

文件好像不全啊,没法用


2005-12-08 15:31
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
〈%
'定义循环变量
dim iPage
Dim ClsName
Dim tErrMsg
ClsName=""
For iPage=1 to rsAREAL.Pagesize
IF rsAREAL.Fields(2).Value〈〉ClsName Then
Response.Write " 〈tr〉"&Chr(13)
Response.Write " 〈td height=20 colspan=3 valign=top〉〈!--DWLayoutEmptyCell--〉 〈/td〉"&Chr(13)
Response.Write " 〈/tr〉"&Chr(13)
Response.Write " 〈tr〉"&Chr(13)
Response.Write " 〈td height=17 colspan=3 valign=top〉〈span class=style1〉〈img src=img/Forum_readme.gif width=18 height=15〉"&rsAREAL.Fields(2).Value&"〈/span〉〈/td〉"&Chr(13)
Response.Write " 〈/tr〉"&Chr(13)
ClsName=rsAREAL.Fields(2).Value
End IF
oTP.ID=rsAREAL.Fields(6).Value
tErrMsg=oTPF.ReToPicInf(oTP)
Response.Write " 〈tr〉"&Chr(13)
Response.Write " 〈td width=237 height=14 valign=top〉〈span class=style1〉〈a href=ToPicList.asp?AREAID="&rsAREAL.Fields(0).Value&" target=_self〉"&rsAREAL.Fields(1).Value&"〈/a〉〈/span〉〈/td〉"
Response.Write " 〈td width=60 rowspan=3 valign=top〉"&rsAREAL.Fields(4).Value&"〈/td〉"&Chr(13)
Response.Write " 〈td width=106 valign=top〉〈span class=style2〉主题:"&Mid(oTP.Title,1,5)&"…〈/span〉〈/td〉"&Chr(13)
Response.Write " 〈/tr〉"&Chr(13)
Response.Write " 〈tr〉"&Chr(13)
Response.Write " 〈td rowspan=2 valign=top〉〈span class=style2〉"&rsAREAL.Fields(3).Value&"〈/span〉〈/td〉"
Response.Write " 〈td height=14 valign=top〉〈span class=style2〉作者:"&oTP.Author&"〈/span〉〈/td〉"&Chr(13)
Response.Write " 〈/tr〉"&Chr(13)
Response.Write " 〈tr〉"&Chr(13)
Response.Write " 〈td height=19 valign=top〉〈span class=style2〉日期:"&FormatDateTime(oTP.Time,2)&"〈/span〉〈/td〉"&Chr(13)
Response.Write " 〈/tr〉"&Chr(13)
Response.Write " 〈tr〉"&Chr(13)
On Error Resume Next
Dim AryM()
Dim Anum
Dim fm
Response.Write "〈td height=12 colspan=3 valign=top〉〈span class=style2〉版主:"
'stop
Anum=LMAF.AryMidStr(AryM,rsAREAL.Fields(5).Value)
For fm=0 To Anum-1
Response.Write AryM(fm)&" "
Next
'Response.Write Err.Description&"T"
Response.Write "〈/td〉"&Chr(13)
Response.Write " 〈/tr〉"&Chr(13)
rsAREAL.MoveNext
IF rsAREAL.EOF Then
Exit For
End If
Next
%〉
这段是内容的循环部分,楼主可以把我写的这个部分删了。改成楼主想要的页面内容循环部分
顶部有两段对于楼主来说无用。
<%
Dim oTP
Dim oTPF
Set oTP=New ToPic
Set oTPF=New ToPicFunction
%>
<%
Dim LMA
Dim LMAF
Dim ErrMsg
Set LMA=New bbsMain
Set LMAF=New MainFunction
ErrMsg=LMAF.InitMain(LMA)
IF ErrMsg<>"" Then
Response.Redirect "ErrPage.asp?ErrorMessage="&ErrMsg
End IF
%>
这两段代码楼主删去就可以用了,这两段对于楼主来说无用,引用页楼主只要把数据库连接引用后就可以用了,其他删去即可。
2005-12-08 15:31
酷酷的鱼
Rank: 1
等 级:新手上路
威 望:1
帖 子:472
专家分:0
注 册:2005-8-9
收藏
得分:0 
好,我试试,谢谢

2005-12-08 16:07
lyf
Rank: 1
等 级:新手上路
帖 子:238
专家分:0
注 册:2005-11-17
收藏
得分:0 
我也遇到同样的问题了,怎么解决???

2005-12-08 16:22
酷酷的鱼
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
lyf
Rank: 1
等 级:新手上路
帖 子:238
专家分:0
注 册:2005-11-17
收藏
得分:0 

我现在做的系统也碰见这样的问题,有谁可以帮助呀??????????


2005-12-08 22:35
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
rsAREAL.Open "SELECT newid,bt,time2 FROM xwtp where leibie='外埠新闻' ORDER BY newid desc",conbbs
红字的这个连接对象楼主没替换把?把它替换成楼主<!--#include file="../include/opendb.asp"-->
引用的这页面中用Set …=Server.CreateObject("ADODB.Connection")打开的Connection对象。
2005-12-08 22:42
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
另外把AREAList.asp换成楼主的页面名称。
2005-12-08 22:43
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
最近准备自己写一个分页类。
2005-12-08 22:44
酷酷的鱼
Rank: 1
等 级:新手上路
威 望:1
帖 子:472
专家分:0
注 册:2005-8-9
收藏
得分:0 
好,谢谢yms123
我试试

2005-12-09 09:46
快速回复:分页显示求助
数据加载中...
 
   



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

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