Dim

E

elia

Hello , I''ve got a problem with "dim".
I want to receive a variable send from a formular with method GET

Why it doesn't work??

<body>
<%
dim name
dim vorname
....
name = request.QueryString("name")
vorname = request.QueryString("vorname")
....
response.write ("name" )
response.write ("vorname" )
....
response.end
%>
</body>

Thanks, pascal
 
M

Mike Brind

elia said:
Hello , I''ve got a problem with "dim".
I want to receive a variable send from a formular with method GET

Why it doesn't work??

<body>
<%
dim name
dim vorname
...
name = request.QueryString("name")
vorname = request.QueryString("vorname")
...
response.write ("name" )
response.write ("vorname" )
...
response.end
%>
</body>

Thanks, pascal

"name" is a reserved word in VBScript. That's why the interpreter is
complaining. You shouldn't use it for variable names, and you definitely
can't Dim it, as it's already in use. Try this:

Dim lastname : lastname = Request.QueryString("name")
 
E

Evertjan.

Mike Brind wrote on 07 dec 2006 in
microsoft.public.inetserver.asp.general:
"name" is a reserved word in VBScript.
That's why the interpreter is complaining.

Are you sure, Mike?

<%
dim name
name = "a"
response.write name
%>

Look, no errors!

<%
option explicit
dim name
name = "a"
response.write name
%>

Look, no errors!
Dim lastname : lastname = Request.QueryString("name")

Last but not least,
a name by any other name smels just as sweet.

The root of the problem is in the quoting.

[and the () are also unneccessary]
 
M

Mike Brind

Evertjan. said:
Mike Brind wrote on 07 dec 2006 in
microsoft.public.inetserver.asp.general:


Are you sure, Mike?

Well, I was, but....

Interesting. It's not in the list
(http://support.microsoft.com/default.aspx/kb/216528), yet my editor
(Dreamweaver) highlights it as a "Native Keyword for VBScript" (and JScript,
for that matter).

On further inspection, it seems that Dreamweaver makes no distinction
between VBScript/JScript reserved words and ADO methods and properties in
terms of its helpful code colouring.

As a prodigious user of Access in the past, I was always aware that Name is
a reserved word there, and generally avoid using it anywhere like the
plague. Just seeing the word in the OP caused bit of a knee-jerk reaction
:)
 
A

Anthony Jones

Mike Brind said:
Well, I was, but....

Interesting. It's not in the list
(http://support.microsoft.com/default.aspx/kb/216528), yet my editor
(Dreamweaver) highlights it as a "Native Keyword for VBScript" (and JScript,
for that matter).

On further inspection, it seems that Dreamweaver makes no distinction
between VBScript/JScript reserved words and ADO methods and properties in
terms of its helpful code colouring.

As a prodigious user of Access in the past, I was always aware that Name is
a reserved word there, and generally avoid using it anywhere like the
plague. Just seeing the word in the OP caused bit of a knee-jerk reaction
:)

In VB6 and VBA it's used to rename a file. Not available in VBScript. I'd
avoid it myself to save the confusion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top