分页问题 求救!新手没分了忘请见谅!

mazhihuei 2005-05-27 04:37:36
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ language=VBscript%>
<%


dim conn ,str
Application("sql")="Driver={Sql Server};Server=MSERVER;DataBase=hxj;UID=sa;PWD=sqlsa"
set conn=server.createobject("ADODB.connection")
conn.open Application("sql")
set FriendListRS=server.createobject("adodb.recordset")
str="SELECT * FROM dd"

FriendListRS.CursorType=AdOpenStatic
FriendListRS.open str,conn
if FriendListRS.eof and FriendListRS.bof then '----->改完的地方
FriendListRS.PageSize=10 '每页显示几条记录
FriendListRS.AbsolutePage=pageno'我感觉PAGENO根本就没有在用过 只是把它存进了里面 可是他不是一刷新又没了吗?
intall=FriendListRS.RecordCount '记录总数
intall2=FriendListRS.PageCount '总页数
end if
do until FriendListRS.eof
response.write FriendListRS(0) & "<br>"
FriendListRS.movenext
loop
pageno=trim(Request("pageno")) '当前页 '----->改
Page_id=trim(Request("Page_id")) '总页id '----->改
yq_lookup=trim(Request("yq_lookup")) '当前查找输入框 '----->改
dim pageno,Page_id,del_hidden,yq_lookup

if pageno="" then '初始化
pageno=1
Page_id=1
del_hidden=""
end if
%>

<HTML>
<HEAD>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>报事登记</title>
<link rel="StyleSheet" href="/css/css.css" type="text/css">
<script type="text/javascript" src="yq_Request.js"></script>
</head>
</HEAD>
<BODY>
<tr>
<td>
<font color="0066cc">[ <%=pageno%> - <%=intall2%> ]</font> 
<%if int(pageno) >1 then%>
<font color="0066cc"><a href="yq_Request.asp?pageno=<%=pageno-1%>&yq_lookup=<%=yq_lookup%>&Page_id=<%=Page_id-FriendListRS.PageSize%>">上一页</font></a> 

<%end if%>
<%if int(pageno) < intall2 then%>
<font color="0066cc"><a href="yq_Request.asp?pageno=<%=pageno+1%>&yq_lookup=<%=yq_lookup%>&Page_id=<%=Page_id+FriendListRS.PageSize%>">下一页</font></a>
<%end if%>

</TD>
</TR>
</BODY>
<head>

</html>
怎么 下一页 上一页 和有多少页都出不来呢我郁闷
<font color="0066cc">[ <%=pageno%> - <%=intall2%> ]</font> 就是这句 是 显示一工有多少页的 急等在线 请说清楚点新手不懂
...全文
81 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
jxsfm 2005-05-27
  • 打赏
  • 举报
回复
解析的好,来顶一下.
aspme 2005-05-27
  • 打赏
  • 举报
回复
那就对了,是空,所以类型会错误啊,给你另外的分页代码:
<%
Set rs = Server.CreateObject("ADODB.Recordset")
strSql = "SELECT * FROM zt ORDER BY ID DESC"
rs.Open strSql, conn, 1, 1

'翻页
iOnePage=20
iTotal=rs.RecordCount
iTotalPage=fix((iTotal-1)/iOnePage)+1

rePage=cint(request("page"))
if rePage<=0 then rePage=1
if rePage>iTotalPage then rePage=iTotalPage

iBeginItem=(rePage-1)*iOnepage+1
if iTotal>0 then rs.AbsolutePosition=iBeginItem
'列表
for i=1 to iOnePage
if i>iTotal-iBeginItem+1 then exit for
%>
<table></table>
<%
rs.MoveNext
next
%>

<table width="100%" height="26" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="right"> 第<%=rePage%>/<%=iTotalPage%>页 <<
<%if rePage>1 then%>
<a href="more.asp?page=<%=rePage-1%>">上一页</a>
<%else%>
上一页
<%end if%>
<%if rePage<iTotalPage then%>
<a href="more.asp?page=<%=rePage+1%>">下一页</a>
<%else%>
下一页
<%end if%>
>></div></td>
</tr>
</table>
mazhihuei 2005-05-27
  • 打赏
  • 举报
回复
```是空 什么也没用 为什么!!!!!!
aspme 2005-05-27
  • 打赏
  • 举报
回复
你再把pageno读出来看看是什么?
mazhihuei 2005-05-27
  • 打赏
  • 举报
回复
按你说的改了 他告诉我这句
<%if int(pageno) >1 then%>




错误类型:
Microsoft VBScript 运行时错误 (0x800A000D)


错误位置:
/wyj/123.asp, 第 52 行


错误描述:
类型不匹配: '[string: ""]'


aspme 2005-05-27
  • 打赏
  • 举报
回复
if not FriendListRS.eof and FriendListRS.bof then
试试
mazhihuei 2005-05-27
  • 打赏
  • 举报
回复
去掉后 它告诉我是
错误类型:
ADODB.Recordset (0x800A0CB3)


错误位置:
/wyj/123.asp, 第 21 行


错误描述:
当前记录集不支持书签。这可能是提供程序或选定的游标类型的限制
请帮我55555555555555555555555555555555555555555555555555
aspme 2005-05-27
  • 打赏
  • 举报
回复
if FriendListRS.eof and FriendListRS.bof then '----->改完的地方

不对吧?这句的意思就是说,如果没有记录的话,执行

FriendListRS.PageSize=10 '每页显示几条记录
FriendListRS.AbsolutePage=pageno'我感觉PAGENO根本就没有在用过 只是把它存进了里面 可是他不是一刷新又没了吗?
intall=FriendListRS.RecordCount '记录总数
intall2=FriendListRS.PageCount '总页数

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧