Annoying syntax error

Ask a Question related to ASP, Design and Development.

  1. #1

    Default Annoying syntax error

    For some reason I can't pin point, it is just bugging me like hell.

    <%
    dim strQuery
    strQuery = "UPDATE Gifts SET"
    strQuery = strQuery & " GuestSelected = " & cint(guestID)
    strQuery = strQuery & ", DateSelected = " & Now()
    strQuery = strQuery & " WHERE GiftID = " & selectGiftID' &
    ";"

    Line 47 -> conn.Execute(strQuery)
    %>



    Error message

    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
    operator) in query expression '21/10/2003 12:19:31 AM'.
    /selectGift.asp, line 47


    Browser Type:
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

    Page:
    POST 8 bytes to /selectGift.asp

    POST Data:
    GiftID=5

    Time:
    Tuesday, 21 October 2003, 12:19:31 AM


    Thanks
    ree Guest

  2. Similar Questions and Discussions

    1. Annoying imode.js error resolved
      There is an invalid XML declaration extention which causes that annoying imode.js error in dreamweaver mx 2004. Took several hours for me to...
    2. really annoying coldfusion MX java error
      Hi there, Anyone know why the following error occurs when trying to run a recently edited cfm file? I know a solution is to delte all of the old...
    3. error : syntax error at or near $1 for over select rows
      This is the error i am getting when calling select * from cas_reset_qi_changedate('CAS','2003-02-03' ERROR: syntax error at or near "$1" at...
    4. annoying error
      I have a asp.net app. ( been working fine so far ) Has anyone seen this before; "Cannot execute a program. The command being executed was...
    5. Annoying IMP error
      Hi, I'm getting the following errorwhen importing my database from one server to another. .. . importing table "WWW_POLL" ...
  3. #2

    Default Re: Annoying syntax error

    > strQuery = strQuery & ", DateSelected = " & Now()

    Access requies # to delimit dates, but Access also knows what now() is, so
    instead of trying to concatenate from ASP, just say

    strQuery = strQuery & ", DateSelected = Now()"
    > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    > [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
    > operator) in query expression '21/10/2003 12:19:31 AM'.
    And stop using ODBC.
    [url]http://www.aspfaq.com/2126[/url]


    Aaron Bertrand - MVP Guest

  4. #3

    Default Re: Annoying syntax error

    In access, your dates need to be surrounded by #'s.

    "ree" <ree@hotmail.coom> wrote in message
    news:Xns941B3A5A27B4reehotmailcoom@210.49.20.254.. .
    > For some reason I can't pin point, it is just bugging me like hell.
    >
    > <%
    > dim strQuery
    > strQuery = "UPDATE Gifts SET"
    > strQuery = strQuery & " GuestSelected = " & cint(guestID)
    > strQuery = strQuery & ", DateSelected = " & Now()
    > strQuery = strQuery & " WHERE GiftID = " & selectGiftID' &
    > ";"
    >
    > Line 47 -> conn.Execute(strQuery)
    > %>
    >
    >
    >
    > Error message
    >
    > Error Type:
    > Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    > [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
    > operator) in query expression '21/10/2003 12:19:31 AM'.
    > /selectGift.asp, line 47
    >
    >
    > Browser Type:
    > Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
    >
    > Page:
    > POST 8 bytes to /selectGift.asp
    >
    > POST Data:
    > GiftID=5
    >
    > Time:
    > Tuesday, 21 October 2003, 12:19:31 AM
    >
    >
    > Thanks

    Tom B Guest

  5. #4

    Default Re: Annoying syntax error

    > strQuery = strQuery & " WHERE GiftID = " & selectGiftID' &

    What's with the single quote after selectGiftID?
    > ";"
    You might want to lose that too. Assuming selectGiftID is numeric, change
    the last line to...
    strQuery = strQuery & " WHERE GiftID = " & selectGiftID


    Randy Rahbar Guest

  6. #5

    Default Re: Annoying syntax error


    "ree" <ree@hotmail.coom> wrote in message
    news:Xns941B3A5A27B4reehotmailcoom@210.49.20.254.. .
    > For some reason I can't pin point, it is just bugging me like hell.
    >
    > <%
    > dim strQuery
    > strQuery = "UPDATE Gifts SET"
    > strQuery = strQuery & " GuestSelected = " & cint(guestID)
    > strQuery = strQuery & ", DateSelected = " & Now()
    > strQuery = strQuery & " WHERE GiftID = " & selectGiftID' & ";"
    >
    > Line 47 -> conn.Execute(strQuery)
    > %>
    >
    >
    Dates are delimited with # in Access databases.


    <%
    strQuery = "UPDATE Gifts SET"
    strQuery = strQuery & " GuestSelected = " & cint(guestID)
    strQuery = strQuery & ", DateSelected = #" & Now() & "#"
    strQuery = strQuery & " WHERE GiftID = " & selectGiftID

    %>


    Ray at work


    Ray at Guest

  7. #6

    Default Re: Annoying syntax error

    There was a line-wrap issue there in your newsreader. He was actually
    commenting out the " & ";"" part. At least that's how I interpreted after
    questioning it also.

    Ray at work

    "Randy Rahbar" <rvrahbarAThotmail.com> wrote in message
    news:eFDYTbxlDHA.976@tk2msftngp13.phx.gbl...
    > > strQuery = strQuery & " WHERE GiftID = " & selectGiftID' &
    >
    > What's with the single quote after selectGiftID?
    >
    > > ";"
    >
    > You might want to lose that too. Assuming selectGiftID is numeric, change
    > the last line to...
    > strQuery = strQuery & " WHERE GiftID = " & selectGiftID
    >
    >

    Ray at Guest

  8. #7

    Default Re: Annoying syntax error

    > There was a line-wrap issue there in your newsreader. He was actually
    > commenting out the " & ";"" part. At least that's how I interpreted after
    > questioning it also.
    Whoops... yeah, that makes more sense. Thanks :)


    Randy Rahbar Guest

  9. #8

    Default Re: Annoying syntax error

    "Aaron Bertrand - MVP" <aaron@TRASHaspfaq.com> wrote in
    news:#OaiRaxlDHA.684@TK2MSFTNGP09.phx.gbl:
    >> strQuery = strQuery & ", DateSelected = " & Now()
    >
    > Access requies # to delimit dates, but Access also knows what now()
    > is, so instead of trying to concatenate from ASP, just say
    >
    > strQuery = strQuery & ", DateSelected = Now()"


    Thanks guys but for some reason not doing what I did before strangely work
    on another page.
    ree Guest

  10. #9

    Default Re: Annoying syntax error

    >
    > Dates are delimited with # in Access databases.
    >
    > strQuery = strQuery & ", DateSelected = #" & Now() & "#"
    > strQuery = strQuery & " WHERE GiftID = " & selectGiftID
    >
    > %>

    Thanks guys but for some reason not doing what I did before strangely work
    on another page.
    ree 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