CFF KB - Carrz-Fox-Fire Promotions Knowledge Base

CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.
  • Breadrumbs:
  • Microsoft OLE DB Provider for SQL Server (0x80040E14) Incorrect syntax near the keyword 'DEFAULT'

  • CFF Knowledge Base - Share With Facebook CFF Knowledge Base - Share on Twitter CFF Knowledge Base - Share on Reddit CFF Knowledge Base - Share on Digg It CFF Knowledge Base - Share on Stumble Upon It CFF Knowledge Base - Share on Delicious
    Share With Friends (Updated 6-8-2010)
  • Article ID:
    26
  • Date Created
    Wednesday, October 6, 2010
  • Last Updated
    Wednesday, November 17, 2010
  • This Article Has been Viewed
    3932 times
  • Short Desc
    When sending information to a sql statement rather it is select, insert, update, delete you will sometimes mistype of incorrectly call your variable to the query.
  • Details
    If your are performing a select, update, insert or delete statement and your variables are not being sent to the statement, then it will cause this error.

     
    Microsoft OLE DB Provider for SQL Server (0x80040E14)
    Incorrect syntax near the keyword 'DEFAULT'.
    page.asp, line 140
  • Recreate Issue
    To recreate this issue, using the following example

    <%
    ID = ProtectSQL(request.Form("IDs"))
    Set sqlDelete = Server.CreateObject("ADODB.Command")
    sqlDelete.ActiveConnection=objConn
    sqlDelete.commandtext="update PDServer set MySendersFolder='Trash' where ID=?"
    sqlDelete.Parameters.Append sqlDelete.CreateParameter("@ID", adInteger, adParamInput, ,ID )
    sqlDelete.execute
    %>


    In the above example, the Request.form("IDs") is not correct.
  • Resolve Issue
    To correct this issue.

    <%
    ID = ProtectSQL(request.Form("ID"))
    Set sqlDelete = Server.CreateObject("ADODB.Command")
    sqlDelete.ActiveConnection=objConn
    sqlDelete.commandtext="update PDServer set MySendersFolder='Trash' where ID=?"
    sqlDelete.Parameters.Append sqlDelete.CreateParameter("@ID", adInteger, adParamInput, ,ID )
    sqlDelete.execute
    %>


    As you can see, the request.form("ID") does not have the s at the end, so the record can now be sent through and deleted in this statement.