473,698 Members | 2,571 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

After Parenthesis in ASP Variables - Query

ll
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
Jun 27 '08
12 1659
"ll" <ba**********@y ahoo.comwrote in message
news:c6******** *************** ***********@k30 g2000hse.google groups.com...
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.

That can't be done, you need an array. I know thats already been said but
things in this thread seemed to have got over complicated for some reason.

Dim strOut_a(4)

' Stuff to assign values to the array elements
For i = 0 To UBound(strOut_a )
Response.Write strOut_a(i) & "<br />"
Next


--
Anthony Jones - MVP ASP/ASP.NET
Jun 27 '08 #11
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 ")
No, you do *NOT* want to do that. As a couple of people pointed out.

You WANT TO USE AN ARRAY.

Dim strOut_a(15)
For i = 1 To 15
strOut_a(i) = objComm("Out" & i & "_a")
Next

And then, where your *OTHER* code *WAS* using
strOut7_a
or whatever, you simply use
strOut_a(7)

What is wrong with that solution??

Now, there *IS* a way to do what you claimed to want. But it is slow slow
slow and clumsy and is not good programming practice and...well, the list
goes on. But if we truly can't convince you to use an array--perhaps because
some other component is expecting the indivdual names? if so, would you
really want to use that component?--then:

For i = 1 To 15
Execute "strOut" & i & "_a = objComm(""Out" & i & "_a"")"
Next

Untested, but I think that's right.

Ugly and slow code, though. Try hard to avoid it.
Jun 27 '08 #12
As I noted:

<%
For i = 1 To 15
Execute "strOut" & i & "_a = objComm(""Out" & i & "_a"")"
Next
%>

Or use ExecuteGlobal, of course.

As I said, a crappy idea, but it does work.
Jun 27 '08 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2036
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 = \"red\">X</font></a>&nbsp;<br />\n";
1
1825
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 =
38
15956
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.
4
2377
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 to use select * from portal.User Thanks Tim
4
2999
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 the user updates back into the database, but how do I get the filled-out form back to the user...
2
1876
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.
3
4718
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?
14
9848
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?
4
5395
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 on the VBA to see what I'm missing. I'm using the form's textbox field txtKitNum (strKit) to test...
0
8610
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
Oralloy
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8902
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
6528
isladogs
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2339
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.