Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

pass check box value to stored procedure

Engaged ,
Sep 10, 2013 Sep 10, 2013

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">

1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 10, 2013 Sep 10, 2013
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources