May 15
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.
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. :)
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. :)
May 15, 2008 at 2:59 PM 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.