CFParam, unless you want to go the multiline route:

<cfif structKeyExists(form, "myVar")>
    <cfqueryparam type="cf_sql_integer" value="#form.myVar#" />

<cfelse>
    <cfqueryparam type="cf_sql_integer" value="" isNull="Yes" />

</cfif>

But you can't go <cfqueryparam type="cf_sql_integer" value="#form.myVar#" 
isNull="#NOT
isNumeric(form.myVar)#" />
because value="#form.myVar#" will fail to compile if form.myVar doesn't 
exist.

----------------------------------------

From: "Dave Watts" <dwa...@figleaf.com>
Sent: Monday, May 03, 2010 12:05 PM
To: "cf-talk" <cf-talk@houseoffusion.com>
Subject: Re: <cfqueryparam> question ("null" attribute)

> I think the point is that if you're going to use any of those 
techniques,
> you DO have to param the variable, or use some other mechanism to make 
sure
> the variable exists. Otherwise the code in your "value" attribute will
> always fail when the variable doesn't exist. Make sense?

Yes. This is the part that, in my initial reading, I didn't even see.
This doesn't have anything to do with CFQUERYPARAM per se, it's just
that you can't reference a variable that doesn't exist at all.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333296
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to