Hello,
I have this code:
_______________ _______________ _______________ ___________
if VarType(eval("i nTotal" & arr(4,i1)))=0 then
response.write "ok, dim"
execute("dim inTotal" & arr(4,i1) & ":inTotal" & arr(4,i1) & "=" &
arr_(i1,i2))
'it is working, I have variable
else
execute("inTota l" & arr(4,i1) & " = inTotal" & arr(4,i1) & " + " &
arr_(i1,i2))
'here is not working any more.
end if
_______________ _______________ _______________ ___________
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/test.asp, line 308
What should be the problem? 6 1607
<iu*********@gm ail.comwrote in message
news:11******** **************@ k70g2000cwa.goo glegroups.com.. .
Hello,
I have this code:
_______________ _______________ _______________ ___________
if VarType(eval("i nTotal" & arr(4,i1)))=0 then
response.write "ok, dim"
execute("dim inTotal" & arr(4,i1) & ":inTotal" & arr(4,i1) & "=" &
arr_(i1,i2))
'it is working, I have variable
else
execute("inTota l" & arr(4,i1) & " = inTotal" & arr(4,i1) & " + " &
arr_(i1,i2))
'here is not working any more.
end if
_______________ _______________ _______________ ___________
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/test.asp, line 308
What should be the problem?
The problem is your using Execute and Eval. Stop using them. Make inTotal
into an array then you don't need them. If arr(4, i1) returns a string then
use a Scripting.Dicti onary object to store a name/value pairs.
Slap this in a VBS file and take a look at how it works:-
Dim arr_(2,2)
Dim temp
Dim Key
Dim i, j
Dim inTotal
For i = 0 to 2
arr_(0,i) = "ListOfValu es" & i
arr_(1,i) = i
arr_(2,i) = i * 2
Next
Set inTotal = CreateObject("S cripting.Dictio nary")
For i = LBound(arr_, 2) to UBound(arr_, 2)
temp = 0
For j = 1 To UBound(arr_, 1)
temp = temp + arr_(j, i)
Next
inTotal(arr_(0, i)) = inTotal(arr_(0, i)) + temp
Next
For Each Key In inTotal
MsgBox Key & " Total = " & inTotal(Key)
Next
Anthony.
I have to use those two (eval and execute), I have no other way to
resolve this because I can have 20 variables or more, just one or none.
So, obviously that I don't know what variables to define. I use option
explicit so it is mandatory to define them.
Another solution is to define an array with n elements (i.e.: arr(58))
and use only some of them (i.e.: arr(1), arr(32)) but in this case I
load in memory a full array. Is not a very good solution.
By the way: I made it work in the way I wanted.
Anthony Jones wrote:
<iu*********@gm ail.comwrote in message
news:11******** **************@ k70g2000cwa.goo glegroups.com.. .
Hello,
I have this code:
_______________ _______________ _______________ ___________
if VarType(eval("i nTotal" & arr(4,i1)))=0 then
response.write "ok, dim"
execute("dim inTotal" & arr(4,i1) & ":inTotal" & arr(4,i1) & "=" &
arr_(i1,i2))
'it is working, I have variable
else
execute("inTota l" & arr(4,i1) & " = inTotal" & arr(4,i1) & " + " &
arr_(i1,i2))
'here is not working any more.
end if
_______________ _______________ _______________ ___________
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/test.asp, line 308
What should be the problem?
The problem is your using Execute and Eval. Stop using them. Make inTotal
into an array then you don't need them. If arr(4, i1) returns a string then
use a Scripting.Dicti onary object to store a name/value pairs.
Slap this in a VBS file and take a look at how it works:-
Dim arr_(2,2)
Dim temp
Dim Key
Dim i, j
Dim inTotal
For i = 0 to 2
arr_(0,i) = "ListOfValu es" & i
arr_(1,i) = i
arr_(2,i) = i * 2
Next
Set inTotal = CreateObject("S cripting.Dictio nary")
For i = LBound(arr_, 2) to UBound(arr_, 2)
temp = 0
For j = 1 To UBound(arr_, 1)
temp = temp + arr_(j, i)
Next
inTotal(arr_(0, i)) = inTotal(arr_(0, i)) + temp
Next
For Each Key In inTotal
MsgBox Key & " Total = " & inTotal(Key)
Next
Anthony.
<iu*********@gm ail.comwrote in message
news:11******** **************@ e3g2000cwe.goog legroups.com...
I have to use those two (eval and execute), I have no other way to
resolve this because I can have 20 variables or more, just one or none.
So, obviously that I don't know what variables to define. I use option
explicit so it is mandatory to define them.
Another solution is to define an array with n elements (i.e.: arr(58))
and use only some of them (i.e.: arr(1), arr(32)) but in this case I
load in memory a full array. Is not a very good solution.
By the way: I made it work in the way I wanted.
Each to his own. But arr(58) would've been better it equates to ;ess than
1KB of memory and will significantly out perform Executes and Evals.
>
Anthony Jones wrote:
<iu*********@gm ail.comwrote in message
news:11******** **************@ k70g2000cwa.goo glegroups.com.. .
Hello,
>
I have this code:
_______________ _______________ _______________ ___________
>
if VarType(eval("i nTotal" & arr(4,i1)))=0 then
response.write "ok, dim"
execute("dim inTotal" & arr(4,i1) & ":inTotal" & arr(4,i1) & "=" &
arr_(i1,i2))
'it is working, I have variable
else
execute("inTota l" & arr(4,i1) & " = inTotal" & arr(4,i1) & " + " &
arr_(i1,i2))
'here is not working any more.
end if
_______________ _______________ _______________ ___________
>
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/test.asp, line 308
>
What should be the problem?
>
The problem is your using Execute and Eval. Stop using them. Make
inTotal
into an array then you don't need them. If arr(4, i1) returns a string
then
use a Scripting.Dicti onary object to store a name/value pairs.
Slap this in a VBS file and take a look at how it works:-
Dim arr_(2,2)
Dim temp
Dim Key
Dim i, j
Dim inTotal
For i = 0 to 2
arr_(0,i) = "ListOfValu es" & i
arr_(1,i) = i
arr_(2,i) = i * 2
Next
Set inTotal = CreateObject("S cripting.Dictio nary")
For i = LBound(arr_, 2) to UBound(arr_, 2)
temp = 0
For j = 1 To UBound(arr_, 1)
temp = temp + arr_(j, i)
Next
inTotal(arr_(0, i)) = inTotal(arr_(0, i)) + temp
Next
For Each Key In inTotal
MsgBox Key & " Total = " & inTotal(Key)
Next
Anthony.
obviously we can't help as we don't know what line 308 is.....
<iu*********@gm ail.comwrote in message news:11******** **************@ k70g2000cwa.goo glegroups.com.. .
Hello,
I have this code:
_______________ _______________ _______________ ___________
if VarType(eval("i nTotal" & arr(4,i1)))=0 then
response.write "ok, dim"
execute("dim inTotal" & arr(4,i1) & ":inTotal" & arr(4,i1) & "=" &
arr_(i1,i2))
'it is working, I have variable
else
execute("inTota l" & arr(4,i1) & " = inTotal" & arr(4,i1) & " + " &
arr_(i1,i2))
'here is not working any more.
end if
_______________ _______________ _______________ ___________
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/test.asp, line 308
What should be the problem?
Anthony Jones wrote:
<iu*********@gm ail.comwrote in message
news:11******** **************@ e3g2000cwe.goog legroups.com...
I have to use those two (eval and execute), I have no other way to
resolve this because I can have 20 variables or more, just one or none.
So, obviously that I don't know what variables to define. I use option
explicit so it is mandatory to define them.
Another solution is to define an array with n elements (i.e.: arr(58))
and use only some of them (i.e.: arr(1), arr(32)) but in this case I
load in memory a full array. Is not a very good solution.
By the way: I made it work in the way I wanted.
Each to his own. But arr(58) would've been better it equates to ;ess than
1KB of memory and will significantly out perform Executes and Evals.
Anthony Jones wrote:
<iu*********@gm ail.comwrote in message
news:11******** **************@ k70g2000cwa.goo glegroups.com.. .
Hello,
I have this code:
_______________ _______________ _______________ ___________
if VarType(eval("i nTotal" & arr(4,i1)))=0 then
response.write "ok, dim"
execute("dim inTotal" & arr(4,i1) & ":inTotal" & arr(4,i1) & "=" &
arr_(i1,i2))
'it is working, I have variable
else
execute("inTota l" & arr(4,i1) & " = inTotal" & arr(4,i1) & " + " &
arr_(i1,i2))
'here is not working any more.
end if
_______________ _______________ _______________ ___________
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/test.asp, line 308
What should be the problem?
>
The problem is your using Execute and Eval. Stop using them. Make
inTotal
into an array then you don't need them. If arr(4, i1) returns a string
then
use a Scripting.Dicti onary object to store a name/value pairs.
>
Slap this in a VBS file and take a look at how it works:-
>
Dim arr_(2,2)
Dim temp
Dim Key
Dim i, j
Dim inTotal
>
For i = 0 to 2
arr_(0,i) = "ListOfValu es" & i
arr_(1,i) = i
arr_(2,i) = i * 2
Next
>
Set inTotal = CreateObject("S cripting.Dictio nary")
>
For i = LBound(arr_, 2) to UBound(arr_, 2)
temp = 0
For j = 1 To UBound(arr_, 1)
temp = temp + arr_(j, i)
Next
inTotal(arr_(0, i)) = inTotal(arr_(0, i)) + temp
Next
>
For Each Key In inTotal
MsgBox Key & " Total = " & inTotal(Key)
Next
>
Anthony.
Anthony, if I use arr(n) is more efficiently than using execute("dim
var...") ? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Doohan W. |
last post by:
Hi,
I'm now working with DB2, and I can't find out how to execute the
contents of a string Statement, without using a Java/... procedure,
only using SQL statements.
I know that some SQBDs such as SQL Server allows it as the exemple
bellow shows :
EXECUTE 'SELECT * FROM Test'
Is there any way to do so with DB2 ?
|
by: Norman Fritag |
last post by:
Hi there
The below code executes some queries.
As newbie I was wondering weather you are better of using connection execute
or command execute to execute queries?
I am asking as Gcnndoh.Execute "AppendDataEntrySummaryLevel2" causes a
Run-time error '-2147217900 (80040e14).
If I execute the query from the query editor it's working ok!! No
messages!!!
|
by: Norman Fritag |
last post by:
Hi there
The below code executes some queries.
As newbie I was wondering weather you are better of using connection execute
or command execute to execute queries?
I am asking as Gcnndoh.Execute "AppendDataEntrySummaryLevel2" causes a
Run-time error '-2147217900 (80040e14).
If I execute the query from the query editor it's working ok!! No
messages!!!
|
by: mikegolden |
last post by:
An application I'm working on makes extensive use of output parameters and return values, thus forcing me to use the ADODB Command object to execute the stored procs. For recordset returning stored procs, calling Execute() is no problem using JavaScript:
var rs = cmd.Execute();
However, for non-recordset returning stored procs -- and this app has many -- I need to call Execute() passing adExecuteNoRecords for the Options parameter,...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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,...
|
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...
|
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...
|
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,...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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.
| |