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

Ask a Question related to ASP, Design and Development.

  1. #1

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

    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 Guest

  2. Similar Questions and Discussions

    1. #39588 [NEW]: unpack("a*", "abc\0") does not work as expected
      From: pprasse at actindo dot de Operating system: linux 2.6.10 PHP version: 4.4.4 PHP Bug Type: Scripting Engine problem Bug...
    2. "Acrobat PDF file format is having difficulties expected a non-negative integer"
      Posted this in a wrong folder before. Opening many of my AI 10 docs in AI CS is getting me this error message: "Acrobat PDF file format is having...
    3. "Expected a dict object" with Acrobat Prof 6.0 = lock up
      Trying to view a PDF from a website (www.skidmorednagenealogy.com)(PDF entitled "Family Genetics Project") Using Adobe Acrobat Professional 6.0...
    4. "Operand Expected" error
      I am trying to create a "slider" function that works with a gauge needle. Basically, the lever moves vertically and with each pixel movement, the...
    5. error in "if statement"
      Could anyone tell me what is wrong with this? It must be the word true and the word false. What I am trying to do is set a button to be visible on...
  3. #2

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

    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" <soazine@erols.com> wrote in message
    news:1cdca2a7.0307091847.18d4bbd5@posting.google.c om...
    > 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 Guest

  4. #3

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

    Thanx, Tim, however, your function does not seem to be intuitive
    inasmuch as the coding structure is concerned.. I have to pass back the
    value of "firstname" to another script, so the variable must exist as
    is, even though its origin is from Request.Form("firstname").

    Turns out that Request.Form("whatever") contained double quotes and thus
    hosed up the execute() statement. A nice substitution did the trick.

    Phil

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Phil Powell Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139