在ASP变量中括号后 - 查询 [英] After Parenthesis in ASP Variables - Query

查看:70
本文介绍了在ASP变量中括号后 - 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想知道ASP中的变量声明 - 这是否有一个很好的

资源?在命名变量中,有没有办法在

循环中的括号/变量后面的变量名中包含

个字符?我有很多变量(例如strOut1_a,strOut2_a等)

并认为循环是最好的方法,但我得到了

错误括号后的字符。我的代码如下。

感谢您的帮助或资源。

路易斯


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

= a = 1到3

strOut(a)_a = objComm(" Out"& a&" _a")

response.write(""& a&" _a")

next

Hi,
I''m wondering about variable declaration in ASP - is there a good
resource for this? In naming variables, is there a way to include
characters in a variable name after the parenthesis/variable in a
loop? I have quite a few variables (e.g. strOut1_a, strOut2_a, etc)
and thought a loop would be the best way to do this, but I am getting
errors for the characters after the parenthesis. My code is below.
Thanks for any help or resources.
Louis

-----------------------------------------
for a=1 to 3
strOut(a)_a=objComm("Out"&a&"_a")
response.write("Out"&a&"_a")
next

推荐答案

使用数组,


dim a,arrStrOut (2)''记住数组是基于零的

= a = 0到UBound(arrStrOut)

arrStrOut(a)= a

响应.write(arrStrOut(a))

next


Drew


" ll" < ba ********** @ yahoo.comwrote in message

news:61 ******************** ************** @ p25g2000 hsf.googlegroups.com ...
Use an array,

dim a, arrStrOut(2) ''Remember arrays are zero based
for a = 0 to UBound(arrStrOut)
arrStrOut(a) = a
response.write(arrStrOut(a))
next

Drew

"ll" <ba**********@yahoo.comwrote in message
news:61**********************************@p25g2000 hsf.googlegroups.com...



我想知道ASP中的变量声明 - 这是否有一个很好的

资源?在命名变量中,有没有办法在

循环中的括号/变量后面的变量名中包含

个字符?我有很多变量(例如strOut1_a,strOut2_a等)

并认为循环是最好的方法,但我得到了

错误括号后的字符。我的代码如下。

感谢您的帮助或资源。

路易斯


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

= a = 1到3

strOut(a)_a = objComm(" Out"& a&" _a")

response.write(""& a&" _a")

next
Hi,
I''m wondering about variable declaration in ASP - is there a good
resource for this? In naming variables, is there a way to include
characters in a variable name after the parenthesis/variable in a
loop? I have quite a few variables (e.g. strOut1_a, strOut2_a, etc)
and thought a loop would be the best way to do this, but I am getting
errors for the characters after the parenthesis. My code is below.
Thanks for any help or resources.
Louis

-----------------------------------------
for a=1 to 3
strOut(a)_a=objComm("Out"&a&"_a")
response.write("Out"&a&"_a")
next



ll写道:
ll wrote:
$ b $

我想知道ASP中的变量声明 - 这是否有一个很好的

资源?
Hi,
I''m wondering about variable declaration in ASP - is there a good
resource for this?



我可以看出为什么你找不到一个,因为你把ASP作为一种语言而不是它真正的用语: 平台

支持多种脚本语言,包括vbscript。我确定你是否知道你必须找到一个vbscript引用你会发现这个
http://msdn.microsoft.com/en-us/libr...h6(VS.85).aspx

或者这个:
http://www.microsoft.com/downloads/d...DisplayLang=en


在命名变量中,有没有办法在

循环中的括号/变量后面的变量名中包含

个字符?
In naming variables, is there a way to include
characters in a variable name after the parenthesis/variable in a
loop?



括号后?不,我不确定是否允许使用这种

的语言。当然不是VB,VBA或vbscript。使用vbscript时,

括号在声明数组时,包含要存储在数组中的最大索引值

,以及当引用

数组,项目的索引。


查看

vbscript中有关声明和使用数组的文档。

-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。

After the parentheses? No. I''m not sure there is a language where this
is allowed. Certainly not VB, VBA or vbscript. With vbscript, the
parentheses contain, when declaring the array, the maximum index value
to be stored in the array, and when referring to an item within the
array, the index of the item.

Have a look in the documentation about declaring and using arrays in
vbscript.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.


ll写道:
ll wrote:

我想知道ASP中的变量声明 - 这是否有一个很好的

资源?在命名变量中,有没有办法在

循环中的括号/变量后面的变量名中包含

个字符?我有很多变量(例如strOut1_a,strOut2_a等)

并认为循环是最好的方法,但我得到了

错误括号后的字符。我的代码如下。

感谢您的帮助或资源。

路易斯


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

= a = 1到3

strOut(a)_a = objComm(" Out"& a&" _a")

response.write(""& a&" _a")

next
I''m wondering about variable declaration in ASP - is there a good
resource for this? In naming variables, is there a way to include
characters in a variable name after the parenthesis/variable in a
loop? I have quite a few variables (e.g. strOut1_a, strOut2_a, etc)
and thought a loop would be the best way to do this, but I am getting
errors for the characters after the parenthesis. My code is below.
Thanks for any help or resources.
Louis

-----------------------------------------
for a=1 to 3
strOut(a)_a=objComm("Out"&a&"_a")
response.write("Out"&a&"_a")
next



VBScript允许使用各种有趣的变量名,只要你使用

括号。这是一个有效的表达式:


[strOut(a)_a] = objComm(" Out"& a&" _a")


然而,这不是你想要的,因为它只是一个静态变量名。

OTOH,你可以用JScript得到一些你想要的东西:


for(var ary = [],i = 0; i< 3; i ++){

ary.push({_ a:objComm(" Out"& a& " _a")}

Response.Write(ary [i] ._ a)

}


-

戴夫安德森


未经请求的商业电子邮件将以

VBScript allows all kinds of funny variable names, provided you use
brackets. This is a valid expression:

[strOut(a)_a] = objComm("Out"&a&"_a")

It is not what you want, however, since it is merely a static variable name.
OTOH, you can probably get a little of what you want with JScript:

for (var ary=[],i=0; i<3; i++) {
ary.push({_a:objComm("Out"&a&"_a")}
Response.Write(ary[i]._a)
}

--
Dave Anderson

Unsolicited commercial email will be read at a cost of

这篇关于在ASP变量中括号后 - 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆