Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Dec 2002
    Location
    NW Iowa
    Posts
    185
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Syntax error (missing operator) in query expression

    I purchased a piece of realty software, and am having trouble adding custom fields.

    I'm trying to add the new field I created in the DB to the SQL query.

    When I attempt to submit the form, I get the following error message:
    Error Type:
    Microsoft JET Database Engine (0x80040E14)
    Syntax error (missing operator) in query expression '1',LIST_LAKE = ''.
    /carlson/sm_includes/functions.asp, line 97
    I've posted what I believe to be the relevant code below, with my added items highlighted in red. Please help me out, as I'm feeling quite stupid here and could really use a little boost in my evening.

    Thanks,
    Matt

    Code:
    *************
    'Check posted values and update database with new values
     '*************************************************
    *************
    	IF Request.QueryString("upd") = "go" THEN
    	
    		list_id = Request.Form("list_id") * 1
    		list_address = Request.Form("list_address")
    		list_location = Request.Form("list_location") * 1
    		list_desc = Request.Form("list_desc")
    		list_features = Request.Form("list_features")
    		list_add_info = Request.Form("list_add_info")
    		list_price = Request.Form("list_price")
    		list_pricing = Request.Form("list_pricing") * 1
    		list_status = Request.Form("list_status") * 1
    		list_order = Request.Form("list_order") * 1
    		list_featured = Request.Form("list_featured") * 1
    		list_viewable = Request.Form("list_viewable")
    		list_lake = Request.Form("list_lake")
    				
    		CALL sql_safe(list_address)
    		CALL sql_safe(list_desc)
    		CALL sql_safe(list_features)
    		CALL sql_safe(list_add_info)
    		CALL fix_number(list_price)
    	
    		errortext = "<p><span class='rednotice'>Errors have occured</span><br>Please correct the errors listed below:</p>"
    		' errortext = CheckNotBlank(errortext,errorno,"Address",list_address)
    		errortext = CheckNotBlank(errortext,errorno,"Description",list_desc)
    		errortext = CheckNumber(errortext,errorno,"Price",list_price)
    		
    		IF errorno = 0 THEN
    				
    			sql_table = "TBL_LISTINGS"
    			sql_set = "LIST_DATE = #" & Date() & "#,LIST_LOCATION = " & list_location & ",LIST_ADDRESS = '" & list_address & "',LIST_DESC = '" & list_desc & "',LIST_FEATURES = '" & list_features & "',LIST_ADD_INFO = '" & list_add_info & "',LIST_PRICE = " & list_price & ",LIST_PRICING = " & list_pricing & ",LIST_STATUS = " & list_status & ",LIST_ORDER = " & list_order & ",LIST_VIEWABLE = '" & list_viewable & "',LIST_FEATURED = " & list_featured & "',LIST_LAKE = '" & list_lake
    			sql_where = "LIST_ID = " & list_id
    			
    			CALL  UpdateRecord(updListing,sql_table,sql_set,sql_wher
    e)
    						
    			Response.Redirect("listings.asp?l=" & Request.QueryString("l"))
    			
    		END IF
    		
    	END IF
    EDIT:
    If I remove the apostrophe (') before LIST_LAKE of the sql_set, then I get the following error message instead:
    Error Type:
    Microsoft JET Database Engine (0x80040E14)
    Syntax error in string in query expression '' WHERE LIST_ID = 149'.
    /carlson/sm_includes/functions.asp, line 97
    Last edited by mattboy_slim; 11-18-2003 at 03:57 AM.

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Instead of this:
    ...LIST_FEATURED = " & list_featured & "',LIST_LAKE = '" & list_lake

    Try something more like this (assuming text fields in the database):

    LIST_FEATURED = '" & list_featured & "', LIST_LAKE = '" & list_lake & "'"
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    I think the problem is in missing single quotes

    ... & "',LIST_FEATURED = '" & list_featured & "',LIST_LAKE = '" & list_lake & "'"

    where the bold text are the ones I added.

    The single quote at the end will depend on what UpdateRecord() does when forming the whole SQL statement.

    Can you post the code in UpdateRecord()?

    The best way to debug syntax errors in SQL statements is to response.write them.

    response.write(strSQLVariable)
    response.end

    try to put that 2 lines and then post the output here.
    Last edited by glenngv; 11-18-2003 at 05:35 AM.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #4
    Regular Coder
    Join Date
    Dec 2002
    Location
    NW Iowa
    Posts
    185
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Thanks for the help guys. This works. Awesome.

    Code:
     & ",LIST_LAKE = '" & list_lake & "'"

  • #5
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Rock 'n' roll!
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips


  •  

    Posting Permissions

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