Dim

Discussion in 'ASP General' started by elia, Dec 7, 2006.

  1. elia

    elia Guest

    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
     
    elia, Dec 7, 2006
    #1
    1. Advertising

  2. elia

    Mike Brind Guest

    "elia" <> wrote in message
    news:...
    > 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")

    --
    Mike Brind
     
    Mike Brind, Dec 7, 2006
    #2
    1. Advertising

  3. elia

    Evertjan. Guest

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

    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)
     
    Evertjan., Dec 7, 2006
    #3
  4. elia

    Mike Brind Guest

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

    "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
    :)
     
    Mike Brind, Dec 7, 2006
    #4
  5. Re: What's in a name? was: Re: Dim

    "Mike Brind" <> wrote in message
    news:u%...
    >
    > "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.
     
    Anthony Jones, Dec 7, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VB Programmer
    Replies:
    3
    Views:
    423
    Chris Mahoney
    Jul 13, 2003
  2. Andreas Klemt
    Replies:
    1
    Views:
    465
    Steve C. Orr, MCSD
    Jul 23, 2003
  3. Keith

    Dim Command Question

    Keith, Sep 29, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    3,614
    Keith
    Sep 29, 2004
  4. Denis Palas
    Replies:
    1
    Views:
    531
  5. Florian Kaufmann
    Replies:
    1
    Views:
    393
Loading...

Share This Page