execute + ArraySearch causes "Expected end of statement" error - Why?

Discussion in 'ASP General' started by Phil Powell, Jul 10, 2003.

  1. Phil Powell

    Phil Powell Guest

    Here is the function ArraySearch:

    '--------------------------------------------------------------------------------------
    'ArraySearch will return an integer value indicating the first
    occurrence of a string
    'within an array. for now it only does a case-sensitive
    first-occurrence search.
    '
    'Created by Phil Powell on 6/28/2002
    '--------------------------------------------------------------------------------------
    Function ArraySearch(myArray, myString)
    Dim i
    ArraySearch = -1
    for i = LBound(myArray) to UBound(myArray)
    if strcomp(myArray(i), myString) = 0 and ArraySearch < 0 then
    ArraySearch = i
    next
    End Function


    Ok now here is the offending code:

    formVarsArray = array("gbID", "firstname", "lastname", "email", "url",
    "fave_bands", "gb_entry")

    ....

    if ArraySearch(formVarsArray, key) >= 0 then
    execute(key & " = """ & Request.Form(key) & """" & vbcrlf)
    if key = "gbID" then gbID = CInt(gbID)
    end if

    When running this code I get the following error:

    Microsoft VBScript compilation error '800a0401'

    Expected end of statement

    /soa/val_cma/gb_listing_edit.asp, line 46

    Here is line 46:
    execute(key & " = """ & Request.Form(key) & """" & vbcrlf)

    I am trying to dynamically set all variables whose names are keys in
    the Request.Form collection object to their perspective values, for
    example

    Request.Form("firstname") = "Phil"
    therefore firstname will = "Phil" also

    So, basically, what's up? Why is this breaking?

    Phil
    Phil Powell, Jul 10, 2003
    #1
    1. Advertising

  2. Phil Powell

    Ray at Guest

    I hate the execute statement. It should be removed. Okay, not really...

    Maybe you mean:

    execute("response.write key & "" = "" & Request.Form(key) & vbcrlf")

    Ray at home

    "Phil Powell" <> wrote in message
    news:...
    > Here is the function ArraySearch:
    >
    > '
    > When running this code I get the following error:
    >
    > Microsoft VBScript compilation error '800a0401'
    >
    > Expected end of statement
    >
    > /soa/val_cma/gb_listing_edit.asp, line 46
    >
    > Here is line 46:
    > execute(key & " = """ & Request.Form(key) & """" & vbcrlf)
    >
    Ray at, Jul 10, 2003
    #2
    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. KathyB
    Replies:
    0
    Views:
    954
    KathyB
    Jun 24, 2003
  2. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    838
    Mark Rae
    Dec 21, 2006
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,675
    Smokey Grindel
    Dec 2, 2006
  4. Graham James Campbell CS2000

    Expected end of statement problem

    Graham James Campbell CS2000, Oct 3, 2003, in forum: ASP General
    Replies:
    7
    Views:
    237
    Graham Campbell
    Oct 3, 2003
  5. Dax
    Replies:
    3
    Views:
    135
Loading...

Share This Page