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 JET Database Engine error '80040e14' Syntax error in UPDATE statement, access 2007 reserved words

  • 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:
    138
  • Date Created
    Wednesday, June 22, 2011
  • Last Updated
    Saturday, June 25, 2011
  • This Article Has been Viewed
    1805 times
  • Short Desc
    Access Database 2007 - 2010 have a reserved word list that is slightly different from previous versions of Access, and with this change, we have to do things a little differently than we had to before.
  • Details
    Access 2007 - 2010 have reserved words that are different from previous versions of Microsoft Access. And with this change, we have to make sure that are coding changes along with it. Why Microsoft decided to add in these new words is most likely for security issues, Either way, we have to change along with them.
    If you use the reserved word in your Select, Update, Delete, Insert Statements without first adding brackets around the reserved word, you will get an error like the following.

     
    Microsoft JET Database Engine error '80040e14'
    Syntax error in UPDATE statement.
    /encrypt.asp, line 28
  • Recreate Issue
    To recreate this issue.

    <%
    Set getPW = Server.CreateObject("ADODB.Command")
    getPW.ActiveConnection=objConn
    getPW.CommandText = "update Users set password=? where password=?"
    getPW.Parameters.Append getPW.CreateParameter("@password", adVarChar, adParamInput, 255, md5(chPW("password")))
    getPW.Parameters.Append getPW.CreateParameter("@password", adVarChar, adParamInput, 255, chPW("password"))
    getPW.execute
    %>


    In Access Database, the word: Password
    Is a reserved word.
  • Resolve Issue
    To resolve this issue.

    <%
    Set getPW = Server.CreateObject("ADODB.Command")
    getPW.ActiveConnection=objConn
    getPW.CommandText = "update Users set [password]=? where [password]=?"
    getPW.Parameters.Append getPW.CreateParameter("@password", adVarChar, adParamInput, 255, md5(chPW("password")))
    getPW.Parameters.Append getPW.CreateParameter("@password", adVarChar, adParamInput, 255, chPW("password"))
    getPW.execute
    %>


    What we have done here to correct the issue without having to change our column name in our database, is to add brackets around the word: Password