<% hour = Request("controlname") %> will yield the following error:
Microsoft VBScript runtime (0x800A01F5)
Illegal assignment: 'hour'
However, if I declare hour, then it is fine.
<%
Dim hour
hour = Request("controlname")
%>
But I think in VBScript, declaration of a variable is optional? That means
we can use the variable without writing "Dim hour" ??
Please advise! thanks! 3 15135
If u use a variable name that is NOT a function name as well, then u don't
have to declare it.
Hour( ) is a built-in function.
"Matt" <ma*******@hotmail.com> wrote in message
news:uG**************@TK2MSFTNGP09.phx.gbl... <% hour = Request("controlname") %> will yield the following error:
Microsoft VBScript runtime (0x800A01F5) Illegal assignment: 'hour'
However, if I declare hour, then it is fine. <% Dim hour hour = Request("controlname") %>
But I think in VBScript, declaration of a variable is optional? That means we can use the variable without writing "Dim hour" ??
Please advise! thanks!
Matt wrote: <% hour = Request("controlname") %> will yield the following error:
Hour() is a builtin vbscript function. Do NOT use ambiguous words for
variable names. Microsoft VBScript runtime (0x800A01F5) Illegal assignment: 'hour'
This is why "hour" should not be used for the variable name.
However, if I declare hour, then it is fine.
No, it is not.
<% Dim hour hour = Request("controlname") %>
Try calling the Hour() function after declaring it as a variable.
dim hour
hour=3
Response.Write(hour(#13:25:00#))
You will quickly see why it is not fine. :-)
Now I realize that it can add much time to your coding if you have to look
up all the variable names you wish to use in online documentation to make
sure you aren't using a keyword. The solution is to use a naming convention
that will guarantee that your variable names never conflict with builtin
names. The convention can be as simple as always prefixing your variables
with the letter "v", vHours instead of hours. Or it can be a little more
informative (as well as making your code more self-documenting) by using
"str" for string variables, "int" for integers, etc. But I think in VBScript, declaration of a variable is optional?
That does not make it right to do so. Always use "Option Explicit" at the
beginning of your code blocks. This will force you to declare your variables
and prevent embarassing and time-consuming mistakes.
HTH,
Bob Barrows
--
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"
Yeah, just use theHour or somthing to that effect ... or when I am
lazy, I will pout the letter z in front of everything .. LOL
zHour
On Sat, 10 Jan 2004 23:23:05 -0800, "Matt" <ma*******@hotmail.com>
wrote: <% hour = Request("controlname") %> will yield the following error:
Microsoft VBScript runtime (0x800A01F5) Illegal assignment: 'hour'
However, if I declare hour, then it is fine. <% Dim hour hour = Request("controlname") %>
But I think in VBScript, declaration of a variable is optional? That means we can use the variable without writing "Dim hour" ??
Please advise! thanks! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Matt |
last post by:
The ASP page has a combo box with id list, and when user click the
particular id, it will show the name in the text box. My attempt was when
the user have event on combo box, it will call...
|
by: JNariss |
last post by:
Hello,
I have created a connection to my Access database with Dreamweaver and
made a simple form with 4 fields.
The code behind this form was/is:
<%@LANGUAGE="VBCRIPT" CODEPAGE="1252"%>...
|
by: Snow |
last post by:
Hello:
I have Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: ''
The error happened at this line: if session("systemIdCount" &
arrSystems(iLoop)) 0
The code like this:
|
by: anidmarty |
last post by:
Hey
I'm a Sysadmin and my users are getting this error on my production box.
It works fine on the dev box.
There is a script that is run that generates this error.
Production is clustered...
|
by: rohitdoke |
last post by:
Hello,
we are using IIS 6.0 and facing an error as
Microsoft VBScript runtime error '800a01c2'
Wrong number of arguments or invalid property assignment: 'verifychecksum'
...
|
by: monika |
last post by:
Hello:
I have Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: ''
/OnlineLIB/BNosearch1.asp, line 32
The error happened at this line:bookno = chr(bookno)
The code like...
|
by: mudasserrafiq |
last post by:
I am using following asp file default.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="0...
|
by: jasone |
last post by:
hi everyone!
any advice given will be MUCH appreciated, i have spent about 10 hours on this bit of script... a rating system. I am having realt trouble overcoming this problem at runtime
...
|
by: morrisqueto |
last post by:
Hello,
One of my websites just started sending a new rare error. The site has been working for almost 2 years without trouble, but today morning started giving away this error in all my views.
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
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,...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |