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) Invalid column name '

  • 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:
    73
  • Date Created
    Monday, December 20, 2010
  • Last Updated
    Monday, December 20, 2010
  • This Article Has been Viewed
    2480 times
  • Short Desc
    Migrating from Access Database to SQL Server takes a little time editing your code to work properly with the new database setup.
  • Details
    When you migrate from Access Database to SQL Server, there are some things that have to be edited and changed along the way to make your ASP Pages rather ASP Classic or ASP.net to work and function with the new and better database system.
    One of the things is the way you define a value in your Statement.

     
    Microsoft OLE DB Provider for SQL Server (0x80040E14)
    Invalid column name 'Yes'.
    /header.asp, line 208
  • Recreate Issue
    To recreate the issue;

    <%
    sqlGetSales.commandtext="SELECT CatID, SalCheck FROM SalesTable WHERE SaleCheck=Yes"
    %>

    The above SQL Statement is from an ASP page running from an Access Database.
    As you can see, the
    <%
    SaleCheck=Yes
    %>
    .
  • Resolve Issue
    To write the above scrip to work with SQL Server, you will need to wrap the value of Yes with single Quotes.

    <%
    sqlGetSales.commandtext="SELECT CatID, SalCheck FROM SalesTable WHERE SaleCheck='Yes'"
    %>


    As you can see, we have 'Yes' instead Yes which was used in Access Database Connection.


    --------
    Related Articles
    Microsoft OLE DB Provider for SQL Server (0x80040E14) Incorrect syntax near the keyword 'off' or Incorrect syntax near the keyword 'on'«