Results 1 to 5 of 5

Thread: ASP Error - Syntax Error

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Posts
    108

    ASP Error - Syntax Error

    strSQL = "insert into course values ('"+request.form("dNAME")+"','"+request.form("cNAME")+"',"+request.form("cNO")+");"

    This is the error which i received while trying to do an insert statement into a database.

    Could someone help me ?

    Error:

    Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

    [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.

    Thank you.

  2. #2
    Lively Member SpagettiProg's Avatar
    Join Date
    Dec 2004
    Location
    Miami, Florida
    Posts
    82

    Re: ASP Error - Syntax Error

    This is probably because you are trying to insert values into a column that does not allow NULL values.

    You can change this setting in SQL enterprise manager.

    Let me know if you still have problems.
    If you feel my post has helped, please rate it
    http://www.silentthread.com

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Posts
    108

    Re: ASP Error - Syntax Error

    adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db1.mdb")

    Is there anything wrong with this line of codes?

    Thank you, cause i did add in values into the required fields.

  4. #4
    Junior Member
    Join Date
    Jun 2006
    Posts
    24

    Re: ASP Error - Syntax Error

    Are you using javascript as your ASP language? If not, you are using a wrong syntax to concatenate string. Use "+" for javascript, use "&" for vbscript.

    Try this:
    strSQL = "insert into course values ('" & request.form("dNAME") & "','" & request.form("cNAME") & "'," & request.form("cNO") & ");"

  5. #5
    PowerPoster
    Join Date
    May 2006
    Posts
    2,988

    Re: ASP Error - Syntax Error

    Make sure they arent null also, especially the Number Field ..

    VB Code:
    1. adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("./db1.mdb")
    2.  
    3. strSQL = "INSERT INTO course (dNAME, cNAME, cNO) VALUES ('" & request.form("dNAME") & "','" & request.form("cNAME") & "'," & request.form("cNO") & ");"
    4.  
    5. adoCon.Execute(strSQL)

Posting Permissions

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



Click Here to Expand Forum to Full Width