Dim

Dim

am 07.12.2006 08:32:15 von 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??


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


Thanks, pascal

Re: Dim

am 07.12.2006 09:04:53 von Mike Brind

"elia" wrote in message
news:1165474406.314337.278960@n67g2000cwd.googlegroups.com.. .
> 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??
>
>
> <%
> dim name
> dim vorname
> ...
> name = request.QueryString("name")
> vorname = request.QueryString("vorname")
> ...
> response.write ("name" )
> response.write ("vorname" )
> ...
> response.end
> %>
>
>
> 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")

--
Mike Brind

What"s in a name? was: Re: Dim

am 07.12.2006 09:50:19 von exjxw.hannivoort

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.

>> response.write ("name" )

The root of the problem is in the quoting.

[and the () are also unneccessary]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Re: What"s in a name? was: Re: Dim

am 07.12.2006 10:41:05 von Mike Brind

"Evertjan." wrote in message
news:Xns989263BD2962Eeejj99@194.109.133.242...
> 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?
>

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
:-)

Re: What"s in a name? was: Re: Dim

am 07.12.2006 16:02:59 von Anthony Jones

"Mike Brind" wrote in message
news:u%236pYPeGHHA.1912@TK2MSFTNGP03.phx.gbl...
>
> "Evertjan." wrote in message
> news:Xns989263BD2962Eeejj99@194.109.133.242...
> > 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?
> >
>
> 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.