Hey all, when I INSERT INTO or UPDATE a sql statement, I use <cfqueryparam> tag. If the field allows null value (like field is optional), I use to do this:
That is until I looked at the cf doc on Adobe ( and saw that <cfqueryparam> tag has a null attribute. So I tried using that last night, and the result wasn't what I had hoped. I thought that null="yes" meant if the field would be null if no value is passed, but if some value is passed then that value would be inserted into the dB. That is not what I encountered. Consistantly whereever I used:
the value entered in the dB was null. I am using MS SQL 2000.
Any ideas on how to do this?
____________________________________
Just Imagine.
Code:
<cfif isdefined("FORM.Address2")>
<cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.Address2#" maxlength="50">
<cfelse>
NULL
</cfif>
That is until I looked at the cf doc on Adobe ( and saw that <cfqueryparam> tag has a null attribute. So I tried using that last night, and the result wasn't what I had hoped. I thought that null="yes" meant if the field would be null if no value is passed, but if some value is passed then that value would be inserted into the dB. That is not what I encountered. Consistantly whereever I used:
Code:
<cfqueryparam cfsqltype="cf_sql_varchar" value="#FORM.Address2#" maxlength="50" null="yes">
Any ideas on how to do this?
____________________________________
Just Imagine.