<cfqueryparam with null attribute not working for me>
Using CF801 and SQL Server 2005. I have a field in my table defined as (int, null). In my CF .cfc function -
<cffunction name="createReference" access="remote" returntype="string" hint="Add Reference unit. On success return ReferenceID On failure return error message.">
<cfargument name="intsteam_cap_mwe" type="numeric" required="no" default="0">
<cfquery name="insertReferenceData" datasource="#application.DSN#">
INSERT INTO Units
(
SteamCapacity_MWe)
Values
(
<cfqueryparam value="#arguments.intsteam_cap_mwe#" cfsqltype="cf_sql_integer" null="#YesNoFormat(NOT len(trim(arguments.intsteam_cap_mwe)))#">
)
</cfquery>
</cffunction>
However, it gives an error "The INTSTEAM_CAP_MWE argument passed to the createReference function is not of type numeric. "
In my old code, I used <cfif to test if the value is not numeric then I assign a value 0. This works. However, I have so many fields and many<cfif's so I'd like to use the NULL atribute of <cfqueryparam>. In the code above, this is just one of the many fields inside my cffunction.
Please help!
Thanks.
