Solved

datetime problem

Posted on 2003-12-05
2
198 Views
Last Modified: 2013-12-24
i have some datetime value in an employee database (datetime field in sql).  everytime i send over a blank value when i update or add something it comes back with 1/1/1900 value.  how do i send a blank value to a datetime field?

0
Comment
Question by:tpiazza
2 Comments
 
LVL 9

Accepted Solution

by:
shooksm earned 50 total points
ID: 9882702
First, use CFPARAM tag to set a default value:

<cfparam default="" name="FORM.SomeDateField">

Then use the CFQUERYPARAM tag and the NULL attribute on the date field:

<cfquery ...>
INSERT INTO SomeTable (SomeDateField)
        (<cfqueryparam cfsqltype="cf_sql_timestamp" null="#YesNoFormat(Trim(FORM.SomeDateField) EQ "")#" value="#FORM.SomeDateField#">)
</cfquery>

The cfqueryparam tags null attribute can be used to send a NULL value to the database, which is essentially a blank value as long as the field accepts null values.  The YesNoFormat function returns back a yes if the FORM.SomeDateField is blank and no if it contains data.
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9883443
Set default to null !
I dont see why u want to update it !
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now