Currently Being Moderated
Mar 9, 2007 6:38 AM
Using CFMX7, I am running into a problem with inserts of an
empty string. There is a user form that passes data to a second
form to do the record insert. For the SQL insert, I am using
cfqueryparam to specify the input values. The text for the field in
question is pulled from a dropdown list on the input form. It works
fine when a user selects a value but if the dropdown select is left
unselected, the user gets a database error: THE LENGTH OF INPUT
HOST VARIABLE NUMBER 003 IS NEGATIVE OR GREATER THAN THE MAXIMUM. I
have a cfparam statement on the insert page to default the value to
(type="string" default="") since not selecting the dropdown will
result in the form field not being passed.
The debug output shows (param 3) = [type='IN',
class='java.lang.String', value='', sqltype='cf_sql_char'] so it
looks like the value is getting passed to the database as an empty
string. Does anybody have an idea of the problem? The backend
database is DB2 OS/390 v.7.
Thanks,
Brian