asp-classic - Microsoft VBScript 运行时错误 '800a0009'

标签 asp-classic runtime-error

最近接手了一个ASP的网站,不太熟悉。昨天,其中一个页面开始报错:

Microsoft VBScript runtime error '800a0009'

Subscript out of range: 'i'

default.asp, line 19

这是第 13-27 行的代码:

<%
set rs = Server.CreateObject("ADODB.Recordset")
rs.open "SELECT * FROM VENDORS_LIST_TBL WHERE inStr('"& dVendorStr &"','|'&ID&'|')", Cn

DIM dTitle(100), dDescription(100), dLink(100)
i = 0 : Do while NOT rs.EOF : i = i + 1
dTitle(i) = rs.fields.item("dTitle").value
dDescription(i) = rs.fields.item("dDescription").value
dLink(i) = rs.fields.item("dLink").value : if dLink(i) <> "" then dTitle(i) = "<a href=""" & dLink(i) & """>" & dTitle(i) & "</a>"
if NOT rs.EOF then rs.movenext
Loop
x = i

rs.Close : Set rs = Nothing
%>

关于这里发生的事情以及我如何解决它有什么想法吗?

谢谢!

最佳答案

您已将 dTitle、dDescription 和 dLink 声明为大小为 100 的数组。在遍历记录集时,您正在为这些数组分配元素。看起来你的记录集中有超过 100 条记录,所以逻辑试图做类似的事情:

dTitle(101) = rs.fields.item("dTitle").value

这将引发错误,因为您的数组不够大,无法容纳所有数据。

关于asp-classic - Microsoft VBScript 运行时错误 '800a0009',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11064329/

相关文章:

string - 经典 ASP (VBScript) 替换字符串中的特殊字符表现很奇怪

function - 错误 '800a005e' 无效使用 Null : 'CDate' when using a function in ASP Classic-VBScript

visual-studio-2013 - Visual Studio 2013 的 InstallShield LE - 安装错误 ##IDS_ERROR_7## - ##IDS_ERROR_1####IDS_ERROR_2803##

vba - 隐藏框架时无法设置可见属性错误

python - 是否存在不在 python 中生成回溯的运行时错误(=异常)?

asp.net - 经典 asp "An error occurred when verifying security for the message."iis7 传输级安全

asp-classic - 经典 ASP : Best way to read & write large (5mb+) files using FileSystemObject

iis - 用于 ODBC 驱动程序的 OLE DB 提供程序错误 "80004005'

c++ - 运行时错误,使我的 .exe 崩溃,我不确定为什么

scala - java.lang.String is not a valid external type for schema of int error in creating spark 数据帧