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 error '80040e14' The name "Draft" is not permitted in this context

  • 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:
    102
  • Date Created
    Monday, February 14, 2011
  • This Article Has been Viewed
    1717 times
  • Short Desc
    While creating your INSERT statement and adding in default values, you may inadvertently not add in the appropriate single Quotes where they belong causing the 80040e14 error.
  • Details
    While creating your INSERT statement, you might want to add in a default value for 1 or more columns. In this process, you may accidentally forgot to add in the single Quotes that go around the intended value. In which case, you will experiance the following error.

     
    Microsoft OLE DB Provider for SQL Server error '80040e14'
    The name "Draft" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.
    /Page.asp, line 242
  • Recreate Issue
    To recreate this issue:

    <%
    sqlReply.ActiveConnection=rhcConn
    sqlReply.commandtext="insert into TableName (MesTitle, MesBody, SenID, RecID, MySenFolder, SenNewOld)values(?,?,?,?,Draft,New)"
    %>


    In the above SQL Insert Statement we are trying to add a default value to the database.
    The default values are: Draft & New
    But, we have neglected to add in our single ' Quotes around our values.
    This in return makes the 2 Values look like they are Column Names when they are not.
  • Resolve Issue
    To resolve this issue.

    <%
    sqlReply.ActiveConnection=rhcConn
    sqlReply.commandtext="insert into TableName (MesTitle, MesBody, SenID, RecID, MySenFolder, SenNewOld)values(?,?,?,?,'Draft','New')"
    %>


    In this example we have wrapped our Values with single Quotes so that the Statement will know that it is infact a Value that needs to be inserted into the database column.