大家看看这个分页显示的代码,晕死了!

coolzdp 2004-01-19 08:01:49

<body>
<%
If isempty(Request.QueryString("pagenumber")) Then
currentpage=1
Else
currentpage=Cint(Request.QueryString("pagenumber"))
End If

set conn=server.CreateObject("adodb.connection")
conn.Open ("DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&server.MapPath("/")&"\access\myinfo_db.mdb")
RS=conn.Execute("select * from log")

RS.PageSize=30 '这里有错误,说是RS无此属性,
'把RS改为set RS=server.CreateObject("adodb.recordset")
'输入RS.后出现快速标记选择器,其中有PageSize的提示,但是错误仍然同上,
'我刚学asp不久,这是参考书上写的一段代码.真不知错在哪里?
'敬请高手指教!
RS.AbsolutePage=currentpage '这里也是

Do Until RS.EOF
Response.Write RS("serialnumber")&"<br>"
RS.MoveNext
Loop
Response.Write "Select Page<br>"
For I=1 to RS.PageCount
Response.Write"<a href=recordset.asp?pagenumber="&I&">"&I&"</a> "
Next
%>
</body>

==================错误如下===================
技术信息(用于支持人员)

错误类型:
Microsoft VBScript 运行时错误 (0x800A01B6)
对象不支持此属性或方法: 'RS.PageSize'
/study/RECORDSET.asp, 第 21 行


浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; MyIE2)

网页:
GET /study/RECORDSET.asp

时间:
2004年1月19日, 19:40:41
...全文
92 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
coolzdp 2004-01-19
  • 打赏
  • 举报
回复
楼上的建立以后也不行
<body>
<%
If isempty(Request.QueryString("pagenumber")) Then
currentpage=1
Else
currentpage=Cint(Request.QueryString("pagenumber"))
End If

set conn=server.CreateObject("adodb.connection")
conn.Open ("DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&server.MapPath("/")&"\access\myinfo_db.mdb")
//////////////////////////
set RS=Server.CreateObject("Adodb.Recordset")
////////////////////////////////////////////////
RS=conn.Execute("select * from log")

RS.PageSize=30
RS.AbsolutePage=currentpage

Do Until RS.EOF
Response.Write RS("serialnumber")&"<br>"
RS.MoveNext
Loop
Response.Write"Select Page<br>"
For I=1 to RS.PageCount
Response.Write"<a href=recordset.asp?pagenumber="&I&">"&I&"</a> "
Next



%>
</body>
=======================================================
技术信息(用于支持人员)

错误类型:
Microsoft VBScript 运行时错误 (0x800A01B6)
对象不支持此属性或方法: 'RS.PageSize'
/study/recordset2.asp, 第 25 行


浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; MyIE2)

网页:
GET /study/recordset2.asp

时间:
2004年1月19日, 21:22:34


详细信息:
Microsoft 支持
ask999 2004-01-19
  • 打赏
  • 举报
回复
没有建立RecordSet对象,所以不具备RecordSet对象的属性。
dim Rs
Set Rs=Server.CreateObject("Adodb.Recordset")
coolzdp 2004-01-19
  • 打赏
  • 举报
回复
RS=conn.Execute("select * from log")
这里的rs不属于recordset对象吗?
如果属于的话应该有pagesize属性啊
DeltaCat 2004-01-19
  • 打赏
  • 举报
回复
楼上的哪里不一样?
nbchp 2004-01-19
  • 打赏
  • 举报
回复
RS=conn.Execute("select * from log")

改成
set RS=server.CreateObject("adodb.recordset")
sql="select * from log"
rs.open sql,conn,1,1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

这个分页程序还有有问题的,程序能够运行,各页显示的数据会和你预期的不一样^_^
jiangjiewebsky 2004-01-19
  • 打赏
  • 举报
回复
RS=conn.Execute("select * from log")
改为
Set Rs=Server.CreateObject("Adodb.Recordset")
SqlStr="select * from log"
Rs.Open SqlStr,Conn,3,3
试一下
DeltaCat 2004-01-19
  • 打赏
  • 举报
回复
RS=conn.Execute("select * from log")
的 RS 不支持分页属性

要用 rs.Open "select * from log",conn,1,1

28,407

社区成员

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

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