This content has been marked as final. Show 4 replies
For starters, stop enclosing your CFQUERYPARAM tags within single quotes.
'<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#Form.FirstName#" />' is not necessary...
use <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#Form.FirstName#">
Fantastic! That did the trick! Thanks!!
I retained all instances of wrapping string-based query variables in single quotes when i updated the site with cfqp's, and am only getting errors when trying to write to the database. should i get rid of them all, even in simple "SELECT" queries?
Also, should i add the null parameter to all the items in my queries that write to the db? For example:
<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#Form.FirstName#" null="#YesNoFormat(Len(Trim(Form.FirstName)))#">
I came across the null variable for the first time this morning and don't know anything about it.
If Cold Fusion gives you an empty string, and the datatype is text, you can make the field null or an empty string. Your choice.
If it's numeric or date, you have to make it null or you'll have a data type mismatch.
The way I do it is to set some variable to either true or false before the query, and set the cfqueryparam null attribute to that variable.
Gotcha. Thanks to you both for the quick replies.