标题:求解,下标越界: '[object]'
只看楼主
wfrtz2556
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-11-13
 问题点数:0 回复次数:1 
求解,下标越界: '[object]'
Microsoft VBScript 运行时错误 错误 '800a0009'


下标越界: '[object]'


/ssb.asp,行 85



<!--#include file="include/head.asp"-->
<!--#include file="include/ssbconfig.asp"-->
<%
Dim SsbName,SsbStyle,SsbListPageSize,SsbTextPageSize,SsbTempClass,SsbAbout,SsbKeyword,j
Dim classicID,Page,wherestr,orderst,orderstr,AllCount,Pages,PastCount,ShowCount,title
act=sqlshow(Request.QueryString("act"))
subclassID=sqlshow(Request.QueryString("subclass"))
classicID=sqlshow(Request.QueryString("classicID"))
Page=Max(Cnum(sqlshow(Request.form("page"))),1)
Page=Max(Cnum(sqlshow(Request("page"))),1)
subclassArray=split(SsbTempClass,"|")

Sub HtmlTltle '标题
Response.write SsbName
End Sub

Sub HtmlKeywords '关键字
Response.write SsbKeyword
End Sub

Sub HtmlDescription '描述
Response.write SsbAbout
End Sub
'========================================================================
'缓存子栏目列表,用|分开子栏目
Sub SsbClass()
Dim sql1,rs1,nowtime
Set rs1=server.createobject("adodb.recordset")
sql1="select * from ssbClass"
rs1.open sql1,conn,1,3
For i=1 To Rs1.RecordCount
Response.write("<span></span><a href=""ssb.asp?subclass="&Rs1("subnum")&""">"&Rs1("subname")&"</a>")
Rs1.MoveNext
Next
rs1.close
End Sub
%>

<%
'sql 提取数据
whereStr="parent=0"
orderStr="SetTop Asc,LastUpdateTime Desc"

'显示子栏目
If IsNumeric(subclassID)=True and Cnum(subclassID)>0 Then
whereStr=whereStr&" and subclass="&subclassID&""
End If

If act="MyPost" Then whereStr=whereStr&" and poster='"&User_ID&"'" '我的主题帖
If act="MyReply" Then whereStr=whereStr&" and ID in(select Parent from ssb where Parent<>0 and poster='"&User_ID&"')" '我参与的回复

Sql="select * from ssb where "&whereStr&"  order by "&orderStr&""
OpenRs(Sql)

'显示页数
AllCount=Rs.RecordCount
Pages=Fix(AllCount/ssbListPageSize)
If Pages*SsbListPageSize<AllCount Then
    Pages=Pages+1   
End If
PastCount=(Page-1)*SsbListPageSize
If AllCount>PastCount Then
    Rs.Move PastCount
End If
ShowCount=Min(AllCount-PastCount,SsbListPageSize)
%>

<%
Sub LieBiao
For i=1 To ShowCount
title=HTMLEncode(ChkBadWords(Rs("Title")))
If Rs("TitleBold") = True Then title="<b>"&title&"</b>"
If Rs("TitleColor")<>"" Then title="<font color="""&Rs("TitleColor")&""">"&title&"</font>"

Dim iconbg
iconbg="ztlb_l0"
If DATEDIFF("s",rs("lastupdatetime"),NOW())<86400 Then iconbg="ztlb_l00"
If Rs("ClickNum")>500 Then iconbg="ztlb_l0hot"
If Rs("SetTop")=True Then iconbg="ztlb_l0top"
'帖前图标
Response.write("<div class=""ztlb_t""><div class="""&iconbg&"""><span class=""niu""><a title=""新窗口打开"" href=""SsbText.asp?id="&Rs("ID")&""">"&title&"</a></span></div>")
'发表时间
Response.write("<div class=""ztlb_l1""><a title=""显示["&Rs("poster")&"]的基本信息"" href=""javascript:memberinfo('"&Rs("Poster")&"')"">"&Rs("Poster")&"</a><br>"&OnlyDate(Rs("PostTime"))&"</div>")
'主题
Response.write("<div class=""ztlb_l2""><a title=""查看“"&subclassArray(Rs("subclass"))&"”的全部帖子"" href=ssb.asp?subclassID="&Rs("subclass")&"><font color=#666666>["&subclassArray(Rs("subclass"))&"]</font></a>&nbsp;<a href=""SsbText.asp?id="&Rs("ID")&""">"&title&"</a>")
If Rs("Classic")=True Then Response.write("<span class=""tuijian"" title=""推荐"">&nbsp;</span>")
If Rs("isPic")=True Then Response.write("<span class=""tupian"" title=""图片"">&nbsp;</span>")
If Rs("Lock")=True Then Response.write("<span class=""lock"" title=""锁定状态,不允许回复!"">&nbsp;</span>")
Response.write("</div>")
'最后更新
Response.write("<div class=""ztlb_l3"">")
If Rs("LastUpdateUser")<>"" Then Response.write("<a title=""显示["&Rs("LastUpdateUser")&"]的基本信息"" href=""javascript:memberinfo('"&Rs("LastUpdateUser")&"')"">"&Rs("LastUpdateUser")&"</a>") Else Response.write("-")
Response.write("<br>"&Rs("LastUpdateTime")&"</div>")
'查看|回复
Response.write("<div class=""ztlb_l4""><span class=""red"">"&Rs("ReplyNum")&"</span>/"&Rs("ClickNum")&"</div></div>")

Rs.MoveNext
Next
Rs.Close
End Sub

Sub FanYe '翻页
Response.write("<span>[共<font color='#cc0000'>"&allcount&"</font>个主题&nbsp;|&nbsp;每页<font color='#cc0000'>"&SsbListPageSize&"</font>个主题]&nbsp;&nbsp;第"&page&"页/共"&pages&"页</span>")
Response.write ShowPages(Pages,Page,"ssb.asp?subclassID="&subclassID&"")
End Sub
'========================================================================
'调用
Sub dyssb(act,number)
dim wherestr,orderstr,title,dyurl,poster,subclassArray

'初始化参数默认值
if number="" or number=0 then number=10
wherestr="parent=0 "

Select Case Act
    Case "recommend"
        wherestr="classic=True and  "&wherestr
        orderstr="order by lastupdatetime DESC,id DESC"
    Case "newpost"
        orderstr="order by posttime DESC,id DESC"
    Case "newreply"
        orderstr="order by lastupdatetime DESC,id DESC"
    Case "hotc"
        orderstr="order by clicknum DESC,id DESC"
    Case "hotr"
        orderstr="order by ReplyNum DESC,id DESC"
    Case "top"
        orderstr="order by SetTopAll desc, SetTop DESC,lastupdatetime,id DESC"
    Case "Random"
        orderstr="order by Rnd(ID-timer())"
    Case Else
        orderstr="order by lastupdatetime DESC,id DESC"
End Select

Sql="Select Top "&Cnum(number)&" Ssb.Id,Ssb.Title,Ssb.TitleColor,Ssb.TitleBold From Ssb WHERE "&wherestr&" "&orderstr&""
Openrs(sql)

If Rs.eof and Rs.bof Then
    Response.Write "<center>该栏目下没有内容!</center>"
    Rs.Close
    Exit Sub
End If

For i = 1 to Rs.Recordcount
if strlen(poster)>10 Then poster=CutStr(poster,9)
title=Rs("title")
If Rs("TitleBold") = True Then title="<b>"&title&"</b>"
If Rs("TitleColor")<>"" Then title="<font color="""&Rs("TitleColor")&""">"&title&"</font>"
Response.write("<li><a href=""ssbtext.asp?id="&rs("id")&""">"&title&"</a></li>")
Rs.Movenext
Next
Rs.Close
End Sub

Sub MyBbs
If User_ID<>"" Then
Response.write(" - <a href=""ssb.asp?act=MyPost"">我的主题</a> - <a href=""ssb.asp?act=MyReply"">回复主题</a>")
End If
End Sub
%>
<!--#include file="html/SsbHeader.html"-->
<!--#include file="html/Ssb.html"-->
<!--#include file="html/SsbFooter.html"-->
<%Call CloseAll()%>
应该如何修改!!求教!!
搜索更多相关主题的帖子: Microsoft include file 
2012-11-13 12:26
hu9jj
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:红土地
等 级:贵宾
威 望:396
帖 子:11713
专家分:43267
注 册:2006-5-13
得分:0 
既然已经提示是下标出界,那就重点检查:1、定义的数组是否足够大,2、循环的终值是否正确。

活到老,学到老! http://www. E-mail:hu-jj@
2012-11-15 14:13



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-386879-1-1.html




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

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