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=obj Comm("Out"&a&"_ a")
response.write( "Out"&a&"_a ")
next 12 1651
Use an array,
dim a, arrStrOut(2) 'Remember arrays are zero based
for a = 0 to UBound(arrStrOu t)
arrStrOut(a) = a
response.write( arrStrOut(a))
next
Drew
"ll" <ba**********@y ahoo.comwrote in message
news:61******** *************** ***********@p25 g2000hsf.google groups.com...
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=obj Comm("Out"&a&"_ a")
response.write( "Out"&a&"_a ")
next
ll wrote:
Hi,
I'm wondering about variable declaration in ASP - is there a good
resource for this?
I can see why you had trouble finding one, given that you were treating
ASP as a language rather than what it really is: a "platform" which
supports several scripting languages, including vbscript. I'm sure if
you knew you had to find a vbscript reference you would have found this http://msdn.microsoft.com/en-us/libr...h6(VS.85).aspx
or this: 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?
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 wrote:
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=obj Comm("Out"&a&"_ a")
response.write( "Out"&a&"_a ")
next
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:ob jComm("Out"&a&" _a")}
Response.Write( ary[i]._a)
}
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
First of all, there's no reason you couldn't put the suffix *BEFORE* the
parentheses:
-----------------------------------------
for a=1 to 3
strOut_a(a) = objComm("Out"&a &"_a")
next
But if you mean that you want *properties* on a SINGLE indexed variable of
an array...sure, you can do that. Using a VBScript class.
Silly (and not overly well formed) example, just to get the point across:
<%
Class Person
Private mName, mEmail
Public Sub Init( name, email )
me.mName = name
ne.mEmail = email
End Sub
Public Property Get Name( )
Name = me.mName
End Property
Public Property Get EMail( )
EMail = me.mEmail
End Property
End Class
Dim people( 10 )
Set people(3) = New Person
people(3).Init( "Adam", "ad**@abc.c om")
Set people(7) = New Person
people(7).Init( "Joe","jo*@xyz. com")
....
x = 7
Response.Write people(x).Name & " has email address " & people(x).Email
....
%>
Is *THAT* what you are after?
Old Pedant wrote:
First of all, there's no reason you couldn't put the suffix *BEFORE*
the parentheses:
-----------------------------------------
for a=1 to 3
strOut_a(a) = objComm("Out"&a &"_a")
next
But if you mean that you want *properties* on a SINGLE indexed
variable of an array...sure, you can do that. Using a VBScript class.
Silly (and not overly well formed) example, just to get the point
across:
Now that was more helpful than my reply was. Thanks a lot for stepping in.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
On May 28, 5:55 am, "Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcom>
wrote:
Old Pedant wrote:
First of all, there's no reason you couldn't put the suffix *BEFORE*
the parentheses:
-----------------------------------------
for a=1 to 3
strOut_a(a) = objComm("Out"&a &"_a")
next
But if you mean that you want *properties* on a SINGLE indexed
variable of an array...sure, you can do that. Using a VBScript class.
Silly (and not overly well formed) example, just to get the point
across:
Now that was more helpful than my reply was. Thanks a lot for stepping in.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Thanks for all your help - this has helped immensely!
On May 29, 11:05 am, ll <barn104_1...@y ahoo.comwrote:
On May 28, 5:55 am, "Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcom>
wrote:
Old Pedant wrote:
First of all, there's no reason you couldn't put the suffix *BEFORE*
the parentheses:
-----------------------------------------
for a=1 to 3
strOut_a(a) = objComm("Out"&a &"_a")
next
But if you mean that you want *properties* on a SINGLE indexed
variable of an array...sure, you can do that. Using a VBScript class.
Silly (and not overly well formed) example, just to get the point
across:
Now that was more helpful than my reply was. Thanks a lot for stepping in.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Thanks for all your help - this has helped immensely!
One more (hopefully quick) question... within the loops as shown in
my code, does each variable created (e.g. strOutP1, strOutP2, etc)
retain its value, or is an array needed for this?
Thanks again,
Louis
One more (hopefully quick) question... within the loops as shown in
my code, does each variable created (e.g. strOutP1, strOutP2, etc)
retain its value, or is an array needed for this?
Ummm...."loops" ??? You only show ONE loop there.
And you don't show *ANY* variables name strOutP1 or strOutP2 or anything
similar to that.
What in the heck are you talking about??? Maybe code you didn't show us?
On Jun 1, 12:40 am, Old Pedant <OldPed...@disc ussions.microso ft.com>
wrote:
One more (hopefully quick) question... within the loops as shown in
my code, does each variable created (e.g. strOutP1, strOutP2, etc)
retain its value, or is an array needed for this?
Ummm...."loops" ??? You only show ONE loop there.
And you don't show *ANY* variables name strOutP1 or strOutP2 or anything
similar to that.
What in the heck are you talking about??? Maybe code you didn't show us?
Sorry for the confusion - allow me to just start from the beginning,
which might be easier. I have a set of variables
(strOut1_a....t o...strOut15_a) .
I'm looking for a way to loop through these variable names to
establish their values, such as:
strOut1_a = objComm("Out1_a ")
but with a loop, rather than writing out each.
Many thanks again,
Louis This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Josh |
last post by:
I have this block of code....
while($i <= $count)
{
$final = mysql_fetch_row($result);
$blocknamelist .= "<a style = \"cursor: pointer\" onmouseout =
\"clear_desc()\" ";
$blocknamelist .= "onclick = delete_block(\"$final\",\"$final\")
onmouseover = display_desc(\"$final\") >";
$blocknamelist .= "<font color =...
|
by: sinthreck |
last post by:
have a query which gets data from two tables.
There's about 20 fields worth of data.
In VB code, I run this query:
strPOItems = "SELECT * FROM LEFT JOIN
OutstandingInvoices ON (.PartNumber =
OutstandingInvoices.PartN) AND (.OrderNo =
OutstandingInvoices.PONumber) AND (.ItemNo =
OutstandingInvoices.ItemNo) AND (.SubOrder =
|
by: Steve Kirsch |
last post by:
I need a simple function that can match the number of beginning and ending
parenthesis in an expression. Here's a sample expression:
( ( "john" ) and ( "jane" ) and ( "joe" ) )
Does .NET have something built-in that can accomplish this, or do I have to
write my own parser? I don't want to reinvent the wheel if possible.
|
by: Oudenhoven, Timothy L |
last post by:
Is there a way to turn off the need to use parenthesis in queries for tablenames etc. I have seen in some documentation examples that parenthesis are not used in the queries. In my install of postgre 7.4 I get an error when I do not use them.
Example with parenthesis which works in my build
select * from portal."User"
where I would like...
|
by: dac |
last post by:
I am quietly going insane on this project. I've never worked on a project like this one before. All my previous sticky forms were for data entry, not editing. I don't know how to display the form with data from the database, allow the user to update it, and then display the form again with POST data. I can get the data out of the database and get...
| |
by: nevil.4u |
last post by:
when we use window.onload=onload_function
we doesn't use parenthesis after the function name y please reply me
about this.
|
by: Thakur vikas |
last post by:
when we run the query then we got
": (Error): ORA-00907: missing right parenthesis"
what may be the error?
|
by: gimme_this_gimme_that |
last post by:
What is going on here with the dollar signs and parenthesis?
$(document).ready(function(){
$("li").behavior("click",function(){
$(this).load(menu.html");
});
});
And when do you use click vs. onclick? Is onclick only an attribute
thing?
|
by: dbrother |
last post by:
Hello All,
I've been plugging away at testing some VBA SQL that executes when a user clicks a button from a 'custom query' form. The user has lots of options as to what parameters should be included in the query, so there might be a better way to handle the syntax here. My main concern right now is just possible getting a fresh set of eyes...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |