看看我的分页代码哪里错啦!系统是安装了.net的,后台是oracle8.05

ahead_lin 2002-07-22 10:15:37
<%@ Language=VBScript %>
<!--#include file="inc/conn.inc" -->
<% 'Set rs=server.createobject("adodb.recordset")
Response.Expires = 0
Server.ScriptTimeOut = 500 '程序运行超时时间,请尽可能设置多的时间。
PageShowSize = 4 '每页显示多少个页连接(就是每页显示几个翻页符)
MyPageSize = 2 '每页显示多少个程序
'=========设置显示内容循环部分=========
Dim numRows
numRows = MyPageSize
Dim index
index = 0
'========判断page参数是否存在或空======
If Not IsNumeric(Request("page")) Or IsEmpty(Request("page")) Or Request("page") <=0 Then
MyPage=1
Else
MyPage=Int(Abs(Request("page")))
End if
dim classid,sqlstr
'按需要打开数据库内容
if request.form("subclass")="" then
sqlstr="select id,title from article_tab where a_class_id="&session("class")
else
sqlstr="select id,title from article_tab where a_subclass_id="&request.form("subclass")
end if
ScriptName = Request.Servervariables("URL")
ScriptVals = Request.Servervariables("QUERY_STRING")
'response.write sqlstr
'response.end
'============ 程序总数 ============
Set Rs=server.createobject("adodb.recordset")
Rs.open sqlstr,conn,1,1
Rs.PageSize = MyPageSize
MaxPages = Rs.PageCount
Rs.absolutepage = MyPage
total = Rs.RecordCount
%>

<html>
<head>
<title>文章发布</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<%
While ((numRows <> 0) AND (NOT Rs.EOF))
Content = rs("content")
Name = rs("title")
response.write "<table><td>"& rs("title") &"</td></table>"
index=index+1
numRows=numRows-1
Rs.MoveNext
Wend

'========循环内容结束===================
Rs.close
Page_link '调用分页函数
Function Page_Link
PageNextSize=int((MyPage-1)/PageShowSize)+1
Pagetpage=int((total-1)/MypageSize)+1
qstring = ScriptName& "?"
if PageNextSize >1 then
PagePrev=PageShowSize*(PageNextSize-1)
Response.write "<a href='" & qstring & "page=" & PagePrev & "' title='上一翻页'>[<<]</a>-"
Response.write "<a href='" & qstring & "page=1' title='页首'>[1]</a>-"
end if
if MyPage-1 > 0 then
Prev_Page = MyPage - 1
Response.write "<a href='" & qstring & "page=" & Prev_Page & "' title='上一页'>[<]</a> "
end if
if Maxpages>=PageNextSize*PageShowSize then
PageSizeShow = PageShowSize
Else
PageSizeShow = Maxpages-PageShowSize*(PageNextSize-1)
End if
If PageSizeShow < 1 Then PageSizeShow = 1
for PageCounterSize=1 to PageSizeShow
PageLink = (PageCounterSize+PageNextSize*PageShowSize)-PageShowSize
if PageLink <> MyPage Then
Response.write "<a href='" & qstring & "page=" & PageLink & "'>[" & PageLink & "]</a> "
else
Response.Write "<B>["& PageLink &"]</B> "
end if
If PageLink = MaxPages Then Exit for
Next
if Mypage+1 <=Pagetpage then
Next_Page = MyPage + 1
Response.write "<a href='" & qstring & "page=" & Next_Page & "' title='下一页'>[>]</A>"
end if
if MaxPages > PageShowSize*PageNextSize then
PageNext = PageShowSize * PageNextSize + 1
Response.write "-<A href='" & qstring & "page=" & Pagetpage & "' title='页尾'>["& Pagetpage &"]</A>"
Response.write "-<a href='" & qstring & "page=" & PageNext & "' title='下一翻页'>[>>]</a>"
End if
End Function
%>
</body>
</html>

conn.inc



<%
set conn=server.createobject("adodb.connection")
dns="Provider=MSDAORA;Persist Security Info=True;User ID=nhrc;Password=nhrc;Data Source=xpelive"
conn.Open dns

%>

...全文
132 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
ahead_lin 2002-07-22
  • 打赏
  • 举报
回复
打错啦conn连接使用oledb的.oracle安装在本机上

。。。
sqlstr="select id,title from article_tab where a_class_id="&cint(session("class"))
。。。

也不行哦。。
ahead_lin 2002-07-22
  • 打赏
  • 举报
回复
打错啦。连接对象是oledb的
ahead_lin 2002-07-22
  • 打赏
  • 举报
回复
conn连接对象不是odbc的.oledb的.
把Rs.absolutepage = MyPage注释掉就没错误,可是不能分页。
gshope 2002-07-22
  • 打赏
  • 举报
回复
你的conn连接对象在哪里??
gshope 2002-07-22
  • 打赏
  • 举报
回复
..
sqlstr="select id,title from article_tab where a_class_id="&cint(session("class"))
....
sqlstr="select id,title from article_tab where a_subclass_id="&cint(request.form("subclass"))
...
Rs.open sqlstr,conn,3,1




ahead_lin 2002-07-22
  • 打赏
  • 举报
回复
楼上的,错误还是一样

试图访问的网页出现问题,无法显示。

--------------------------------------------------------------------------------

请尝试以下方法:

单击 刷新按钮或者梢候再试。

打开 172.100.100.31 主页,然后查找与所需信息相关的链接。
HTTP 500.100 - 内部服务器错误 - ASP 错误
Internet 信息服务

--------------------------------------------------------------------------------

技术信息(适用于支持人员)

错误类型:
ADODB.Recordset (0x800A0CB3)
/nhrc/article_index.asp, 第 35 行 这行Rs.open sqlstr,conn,1,1


浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)

页:
POST 38 bytes to /nhrc/article_index.asp

POST 数据:
class=1&subclass=1&Submit=%CC%E1%BD%BB

时间:
2002年7月22日, 10:26:10


详细信息:
Microsoft 支持

我1,3 3,3 3,2 2,3 1,1都是试过啦。错误还是一样

ahead_lin 2002-07-22
  • 打赏
  • 举报
回复
错误代码
本页无法显示
试图访问的网页出现问题,无法显示。

--------------------------------------------------------------------------------

请尝试以下方法:

单击 刷新按钮或者梢候再试。

打开 172.100.100.31 主页,然后查找与所需信息相关的链接。
HTTP 500.100 - 内部服务器错误 - ASP 错误
Internet 信息服务

--------------------------------------------------------------------------------

技术信息(适用于支持人员)

错误类型:
ADODB.Recordset (0x800A0CB3)
/nhrc/article_index.asp, 第 35 行


浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)

页:
POST 38 bytes to /nhrc/article_index.asp

POST 数据:
class=1&subclass=1&Submit=%CC%E1%BD%BB

时间:
2002年7月22日, 10:06:30


详细信息:
Microsoft 支持


35行是 Rs.open sqlstr,conn,1,1
gshope 2002-07-22
  • 打赏
  • 举报
回复
Rs.open sqlstr,conn,1,1
改成
Rs.open sqlstr,conn,3,1
lanying 2002-07-22
  • 打赏
  • 举报
回复
用了pagesize跟absolutepage就没必要算页数了,你后面的程序有问题

28,409

社区成员

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

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