Professional Web Applications Themes

syntax error (missing operator) query expression - ASP

valuA = (request.form("toadd")) If valuA = "" then SQL = "UPDATE CourseReg SET attended='Active' WHERE ID IN("&request.form("toadd")&")" Set RS = MyConn.Execute(SQL) End If MyConn.Close Set RS = Nothing Set MyConn = Nothing the error syntax error (missing operator) query expression ID IN ()...

  1. #1

    Default syntax error (missing operator) query expression

    valuA = (request.form("toadd"))
    If valuA = "" then
    SQL = "UPDATE CourseReg SET attended='Active' WHERE ID
    IN("&request.form("toadd")&")"
    Set RS = MyConn.Execute(SQL)

    End If
    MyConn.Close
    Set RS = Nothing
    Set MyConn = Nothing
    the error
    syntax error (missing operator) query expression ID IN ()
    alexz Guest

  2. #2

    Default Re: syntax error (missing operator) query expression

    MyConn.Open "media"
    If (Request("toadd") = "") then
    SQL = "UPDATE CourseReg SET attended='' WHERE ID
    IN("&request.form("toadd")&")"
    RESPONSE.WRITE SQL
    RESPONSE.END
    Set RS = MyConn.Execute(SQL)

    That what i get
    UPDATE CourseReg SET attended='' WHERE ID IN()

    if i remove the if statement, i get
    UPDATE CourseReg SET attended='' WHERE ID IN(237)

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

  3. #3

    Default Re: syntax error (missing operator) query expression

    > If (Request("toadd") = "") then
    > SQL = "UPDATE CourseReg SET attended='' WHERE ID
    > IN("&request.form("toadd")&")"
    Think about this. You're saying, "if this value is blank, put blank into
    the IN clause."


    Aaron Bertrand - MVP Guest

  4. #4

    Default Re: syntax error (missing operator) query expression

    1. Why would you want to execute if toadd IS equal to ""? Wouldn't you
    only want to do it if toadd IS NOT equal to ""?

    2. You're using request("toadd") and request.form("toadd"). Perhaps you
    have a querystring that isn't helping things.

    3. Create a variable named sToAdd or something and use sToAdd =
    Request.Form("toadd"). Then use the variable instead of constantly calling
    the value from the form and/or ruquest collection.

    Ray at home

    "Alex zurab" <anonymousdevdex.com> wrote in message
    news:eDKpo59RDHA.1804TK2MSFTNGP11.phx.gbl...
    > MyConn.Open "media"
    > If (Request("toadd") = "") then
    > SQL = "UPDATE CourseReg SET attended='' WHERE ID
    > IN("&request.form("toadd")&")"
    > RESPONSE.WRITE SQL
    > RESPONSE.END
    > Set RS = MyConn.Execute(SQL)
    >
    > That what i get
    > UPDATE CourseReg SET attended='' WHERE ID IN()
    >
    > if i remove the if statement, i get
    > UPDATE CourseReg SET attended='' WHERE ID IN(237)
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Ray at Guest

  5. #5

    Default Re: syntax error (missing operator) query expression


    I tried using variable before and it didn't help.
    the reason i want to execute if toadd IS equal to ""
    is that the checkbox is already checked if there is a value (i.e it's
    been update).
    if i uncheck and resubmit i want that field to be null again
    so a user can fix the record if it was sumbmitted by mistake (not my
    idea but i have boses that want certain things).

    This is how i did it.
    Response.Write("<form action='add.asp' method=Post>")
    if rs("attended") = "Active" then
    Response.Write ("<input type=checkbox name=toadd value="""& rs("id")&"""
    CHECKED>")
    else
    Response.Write ("<input type=checkbox name=toadd value="""&
    rs("id")&""">")
    End if


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

Similar Threads

  1. Syntax error (missing operator) in query expression
    By crystalfish0318 in forum Coldfusion Database Access
    Replies: 3
    Last Post: May 23rd, 06:00 PM
  2. Replies: 6
    Last Post: September 2nd, 01:22 PM
  3. Access: (missing operator) in query expression
    By Bob the ASP Builder in forum ASP Database
    Replies: 1
    Last Post: February 12th, 05:18 AM
  4. Syntax error in Query Expression,
    By Raphael Gluck in forum ASP
    Replies: 1
    Last Post: October 13th, 12:29 PM
  5. Replies: 4
    Last Post: September 29th, 10:23 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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