Instead of len(trim(form.side1collectionsdate)) it would
probably be better to use IsDate(form.side1collectionsdate)
Otherwise anything they type in, date or not, would be
entered.


> Thanks Ian, Randy, and Michael!
> 
> Your suggestions combined helped me. Now I understand (and better 
> appreciate) using <cfqueryparam> especially since it also makes things 
> more secure.
> 
> This line worked: 
> <CFQUERYPARAM VALUE="#form.side1collectionsdate#"
> CFSQLTYPE="CF_SQL_VARCHAR" null="#yesNoFormat(NOT len(trim(form.
> side1collectionsdate)))#">
> 
> Robert O.
> 
> -----Original Message-----
> From: Ian Skinner [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 27, 2005 1:06 PM
> To: CF-Talk
> Subject: RE: OT SQL date/time default
> 
> 
> That is probably your problem.  I presume that form.formdate is a text 
> field.  And a empty text field is ' which is completely different then 
> NULL.  So you are inserting a value into the date field, a value of an 
> empty string, but a value none the less.
> 
> For situations like this and many other good reasons you should read 
> up on the <cfqueryparam> tag.
> 
> To fix your date issue trying changing this line
> 
...
> '#form.formdate#',
> 
> To
> 
> <cfqueryparam value="#form.formdate#" cfsqltype="cf_sql_date" 
> null="#yesNoFormat(NOT len(trim(form.formdate)))#">
> 
> Now looking at your code example, you seem to be inserting your date 
> as a string, not a date?  Is the field in the database a date field or 
> a char|varchar field?
> 
> PS you should change your other inserts to queryparams as well.
> 
> --------------
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA
> 
> "C code. C code run. Run code run. Please!"
> - Cynthia Dunning
> 
> 
> 
...
> -----Original Message-----
...
> From: Robert Orlini [mailto:[EMAIL PROTECTED]
...
> Sent: Thursday, January 27, 2005 9:56 AM
...
> To: CF-Talk
...
> Subject: RE: OT SQL date/time default
...
> 
...
> Ian, Randy,
...
> 
...
> Just a plain insert and I fear that is the problem...only I don't 
> work
...
> with CF enough to know the coding tips.
...
> 
...
> Here it is below:
...
> 
...
> <cfquery name="off" datasource="off">
...
> Insert into off
...
> (
...
> formdate,
...
> admin,
...
> side1collectionsdate,
...
> side2collectionsdate,
...
> side3collectionsdate,
...
> side4collectionsdate,
...
> side5collectionsdate
...
> )
...
> VALUES
...
> (
...
> '#form.formdate#',
...
> '#form.admin#',
...
> '#form.side1collectionsdate#',
...
> '#form.side2collectionsdate#',
...
> '#form.side3collectionsdate#',
...
> '#form.side4collectionsdate#',
...
> '#form.side5collectionsdate#'
...
> )
...
> </cfquery>
> 
> Confidentiality Notice:  This message including any
> attachments is for the sole use of the intended
> recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the
> intended recipient, please contact the sender and
> delete any copies of this message. 
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:192032
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to