Why not define form.myDate in the first place. <cfparam name="form.myDate" default="" />
Then... <cfqueryparam value="#form.myDate#" null="#not len(trim(form.myDate))#" /> Steve -----Original Message----- From: Matthew Lowrey [mailto:[email protected]] Sent: Tuesday, July 06, 2010 11:57 AM To: cf-talk Subject: Re: <cfqueryparam> question ("null" attribute) Hello Everyone (again): Another form of cfqueryparam has come up and I was curious how your outcomes might pan out. The following cfqueryparam passes, BUT when NULL it passes the default date in SQL Server (01/01/1900) Also, I had to take out the cfsqltype, it would error out if I did. <cfqueryparam value="#isDefined('form.myDate')?form.myDate:''#" null="#!isDefined('form.myDate')#" /> So, if I leave the date field blank it enters in this date (01/01/1900) into the db, if I put in a date then its fine. This code works (and I'm currently using): <cfif isDefined("form.myDate") AND #form.myDate# NEQ ""> <cfqueryparam value="#form.myDate#" cfsqltype="cf_sql_timestamp"> <cfelse> <cfqueryparam null="yes"> </cfif> I can keep it this way of course, but I really do like this new format and would like to see if it's possible to use this. Here's my theory, a space is inserted when the field is left blank when I should be passing a NULL value for dates... It's another shot in the dark, so I tried this format: <cfqueryparam value="#isDefined('form.myDate')?form.myDate:'NULL'#" null="#!isDefined('form.myDate')#" /> Simply added in NULL for the else, but that was a no go. Again, it passed through the submitting of the form, but the date still showed up as the default 01/01/1900 date. So far I've been able to figure out integers and vars but here's a new challenge of the date/time. Thanks everyone in advance! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335117 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

