Boolean Problems with MS Access Unicode Driver

i18N , ColdFusion , Database Add comments
If you are using Microsoft Access with Unicode drivers which is defined in ColdFusion administrator, you may have problems with boolean parameters.

Following query is a simple filter for active records but because of problems on the default drivers for MS Access it will return null.

<cfquery name="getActiveUsers" datasource="#request.dsn#">
   SELECT   userid, username, email, isactive
   FROM   users
   WHERE   isActive = 1
</cfquery>
<cfdump var="#getActiveUsers#">


Instead of "isActive = 1" you should use "isActive = TRUE" syntax to get the right result. Of course same applies for FALSE statement.

The other method would be using CFQueryParam but be aware also CFQueryParam problems with Access drivers. :)

1 response to “Boolean Problems with MS Access Unicode Driver”

  1. Dan Roberts Says:
    I seem to recall that -1 was required for true in Access. I usually just use "<> 0" for true and "= 0" for false to cover all my bases.

Leave a Reply





Powered by Mango Blog. Design and Icons by N.Design Studio