coldfusioncoldfusion-10

coldfusion.tagext.sql.QueryParamTag$InvalidDataException: Invalid data value [Column Name] exceeds maxlength setting 20


I have an email field.

 <cfqueryparam cfsqltype="cf_sql_nvarchar"  maxlength="200" value="#structform.Email#">

On insertion, when I supply 20 or fewer characters as input, then insertion goes successful but when I supply more than 20 characters, then I get an exception.

The cause of this output exception was that: coldfusion.tagext.sql.QueryParamTag$InvalidDataException: Invalid data value nisar.ahmad@usefp.org exceeds maxlength setting 20..

Given that in the database (SQL server) the length of this field is 200. and the following insert query successfully run

 Insert into table (Email) values ('ggggggggggggggggtttttttttttttttttttttttttttttggggggggggggggggg@gmail.com')

The input is greater than 20 charachetr.


Solution

  • May be some where else in your code you have the maxlength set. Also check the SQL where clauses. Please also check the max length attribute in the cfqueryparam. You may have explicitly defined it in your code.