SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jan 2005
    Location
    UK
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    sql syntax error '80040e14'

    Hi,

    I am trying to do a page that adds a new record to an access database from an asp page and get the following error:Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

    [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'a new product')'.

    /admin/add_product.asp, line 28

    The SQL that I am using is as follows:

    cid = Request.Querystring("cid")
    prodType = Request.Form("type")
    strSQL = "INSERT INTO product (rangeID, typeID, productName, productDescription)" & _
    " VALUES (" & cid & "," & prodType & ",'" & Replace(Request.Form("name"),"'","''") & _
    "'," & Replace(Request.Form("desc"),"'","''") & "')"

    cid and prodType are both numerical values, and the others are text entries from form fields.

    Can anyone help?

  2. #2
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    va
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi robmc,
    If cid is a string type, you need to add a single quote around it, example:
    ... VALUES ('" & cid & "'," ...

    Do the same for all the rest. Hope that will solve your problem.
    http://www.GeekGig.com - Resources for the Geeks!

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,270
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    you're missing a quote in front of the desc

    see it? it's in red --

    strSQL = "INSERT INTO product (rangeID, typeID, productName, productDescription)" & _
    " VALUES (" & cid & "," & prodType & ",'" & Replace(Request.Form("name"),"'","''") & _
    "','" & Replace(Request.Form("desc"),"'","''") & "')"
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    SitePoint Member
    Join Date
    Jan 2005
    Location
    UK
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your help guys, I don't think I would have spotted that in a million years!


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
  •