possiblilities for null= in <cfqueryparam
why can't I do this:
<cfqueryparam value="#structFromParsedXML
whats the best workaround for this?
why can't I do this:
<cfqueryparam value="#structFromParsedXML
whats the best workaround for this?
nikos101 wrote:
why can't I do this:
<cfqueryparam value="#structFromParsedXML
.ClientID#" cfsqltype="cf_sql_varchar" null="not structKeyExists(structFromParsedXML , 'ClientID')" whats the best workaround for this?
Actually, the logic you wish to apply is a bit subtle. If the key ClientID does not exist in the struct, then you want the value to be NULL. ColdFusion would then ignore the value attribute, whatever it is.
However, I do believe you could improve the code logic by doing something like
Outside cfquery tag:
<cfset isNullValue = true>
<cfset id = "">
<cfif structKeyExists(structFromParsedXML
<cfset isNullValue = false>
<cfset id = structFromParsedXML
</cfif>
Within cfquery tag:
<cfqueryparam value="#id#" cfsqltype="cf_sql_varchar" null="#isNullValue#">
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.