Copy link to clipboard
Copied
I have a check box on the form and want to pass it check or not to my cfstoredproc.
I tried to use followign code I got invalid data error message, I tried to use cf_sql_bit, cf_sql_int, but I always get error message,
My stored procedure expect bit data type, but I can change what ever the check box value is for database server stored procedure.
Your help and information is great appreciated,
Regards,
Iccsi,
<cfstoredproc procedure="MySP">
<cfprocparam value="form.MyCheckBox" cfsqltype="cf_sql_tinyint">
<cfprocresult name="SP1" resultset="1">
</cfstoredproc>
<cfinput type="checkbox" name="MyCheckBox" value="MyCheckBox" id="MyCheckBox">
Copy link to clipboard
Copied
iccsi,
I think the problem you are experiencing is related to how ColdFusion stores boolean values. They are stored as true booleans, not as integer values. So you can't pass them directly to the database as a cf_sql_bit or cf_sql_int value. I usually use a User Defined Function (UDF) to convert boolean values to bit values so they can be used in database interactions. Here is a similar UDF from CFLib.org.
HTH,
-Carl V.