在 for 循环中填充 VBScript 数组
我试图在 VBScript 中创建并填充一个二维数组,该数组驻留在 ASP 页面中。我有以下代码:
Dim array(11, 6)
For record = 0 To 6
array(6, record) = 8
array(7, record) = "test"
Next
array(6, 3) = 8
array(7, 3) = "test"
但是 for
循环不起作用。没有任何内容被填充。如果我明确地执行此操作,就像循环后的代码一样,就可以正常工作。
我以前几乎没有使用过 VBScript,但这似乎应该可以工作。为什么我的循环没有执行任何操作?
I'm attempting to create and fill in a two-dimensional array in VBScript, which resides in an ASP page. I have the following code:
Dim array(11, 6)
For record = 0 To 6
array(6, record) = 8
array(7, record) = "test"
Next
array(6, 3) = 8
array(7, 3) = "test"
The for
loop doesn't work, though. Nothing gets filled in. If I do it explicitly, like the code after the loop, that works just fine.
I've hardly ever used VBScript before but this seems like it should work. Why is my loop not doing anything?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的“行不通”行不通。您必须准确描述您的期望以及发生的情况。否则 -
是否存在邪恶的“On Error Resume Next”活动?
WRT OERN:
您可以在关键/新代码之前插入“On Error GoTo 0”,然后闭上眼睛继续驾驶,并在其后立即插入“On Error Resume Next”。
或者:将新代码复制到干净/空的 .vbs 中以供 cscript.exe 使用
或者:完整发布代码的相关部分。
Your "doesn't work" doesn't work. You'll have to describe exactly what you expect and what happens instead. Otherwise -
Is there an evil "On Error Resume Next" active?
WRT the OERN:
You could insert an "On Error GoTo 0" immediately before the critical/new code and continue driving with your eyes shut with an "On Error Resume Next" immediately after it.
Or: copy the new code into a clean/empty .vbs to be used by cscript.exe
Or: post the relevant part of the code completely.