datetime problem

0
August 16, 2011

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?

2

answers

Comments See all(0)

Add comment
0
August 16, 2011

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_timestam

p" null="#YesNoFormat(Trim(FO

RM.SomeDat

eField) 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
August 16, 2011

Set default to null !

I dont see why u want to update it !

Related Questions

what is the problem with this query ...?

hello .. my table called &quot;Table1&quot; have field called &quot; todayDate &quot; with type dateTime ok.. i am write the query as follows: SELECT * FROM Table1 WHERE todayDate = #&#39;-- - 04 - -- Read More

Views

24

Votes

0

Answers

22

August 16, 2011

Vb.Net: DateTime problem

Hi Need some help with a date time function I have what i call a End Date: 2007-10-12 15:34:45 I need to create my start date: My Start date shoud be 8 hours before the End date. The problem is that t Read More

Views

15

Votes

0

Answers

5

August 16, 2011

Datetime values being overwritten

Hello. First, I apologize. I am new to C# and ASP.NET (but not new to programming), and I&#39;m having a little bit of trouble with the transition. My question for the day seems to stem off of the bas Read More

Views

34

Votes

0

Answers

4

August 15, 2011

Asp.net mysql datetime datatype entry

Hi there i have a problem, when when i try to enter a datetime from my asp.net application to mysql database with datetime as the datatype, there is an error mssage which i have screenshot below. This Read More

Views

17

Votes

0

Answers

5

August 15, 2011

.NET Service Client DateTime Time Zone Offset Compatability Issue

I&#39;m attempting to communicate with a Java webservice via a .NET application, using a Visual Studio Service reference (System.ServiceModel namespace classes). I&#39;ve found that whenever it serial Read More

Views

18

Votes

0

Answers

2

August 16, 2011

Need distinct datetime to appear in drop down.

I have a field in a table called createddate. I am creating a drop down in which I want to show all of the dates that can be selected. The problem is it is a DateTime and will always be distinct so it Read More

Views

14

Votes

0

Answers

6

August 15, 2011

Unit test failing because of millisecond compare on (DateTime?) nullable type (.NET 2.0)

Hi, I have an assert Assert.AreEqual(savedUser. DateCreate d, loadUser.DateCreated, &quot;DateCreated&quot;); The problem is that it fails because loading up from SQL changes the value of the millisec Read More

Views

16

Votes

0

Answers

5

August 15, 2011

.Net Framework 2.0 Datetime conversion from character string

Hi Experts &amp; Guru&#39;s, I&#39;ve have a problem with .Net Framework 2.0 and SQL Express 2005. When installing an application on a non english PC ...i get a .Net Framework error. Conversion failed Read More

Views

14

Votes

0

Answers

2

August 15, 2011

Determine validity in datetime

Hello all, I have a following situation: in a database table there is a date field that determines a validity start for a certain attribute. Scenario: in a nursing home meals are served to patients (g Read More

Views

18

Votes

0

Answers

5

August 15, 2011

Convert Text field to DateTime

Hi everyone, I am querying a .CSV file and would like to order the results by the date. The problem is that the field is not in the correct format i.e. 2802050904 This value represents the 28th Februa Read More

Views

21

Votes

0

Answers

15

August 16, 2011

Passing "" to a datetime cmd parameter in .net web app to sql 2K stored proc gives me 1/1/1900

Hey, I have a .net web application that has a form that users can fill out. &#160;In it, there are some date fields (driver&#39;s license issue date) that are not required, since not all people might Read More

Views

16

Votes

0

Answers

5

August 16, 2011

Problem passing mutiple parameters to s select SQL 2005 SPROC

Hi; I have a web form which contains several textboxes used to capture search criteria. I also have a object data source on the form and control parameters associated with it. The object DataSource is Read More

Views

27

Votes

0

Answers

1

August 16, 2011

A little Help Finishing a schema file to brin XML data into MSSQL2000 using SQLXML3.0

Greets all, I&#39;m pretty new to this - it is a quick and dirty I&#39;m doing as a stop gap for work. &#160;I&#39;m sure it is an easy one, I just cannot quite seem to get my head around this one. &# Read More

Views

35

Votes

0

Answers

1

August 16, 2011

CHAR vs DATETIME

Hello, I have an old SQL Server database where all dates are saved as CHAR(10) (yyyy-MM-dd). The main benefit of this is that I never had a problem with SQL or the web site confusing the day and the m Read More

Views

13

Votes

0

Answers

5

August 15, 2011

Problem with ObjectDataSource

New to using ObjectDataSource, we are working with an application created by another team and they used the ObjectDataSource to bind to a DetailView Control. the insert and Select seem to work fine, b Read More

Views

18

Votes

0

Answers

7

August 16, 2011

Adding DateTime Values in a Calculated Column of Dataset

I am trying to add a calculated &#160;&quot;Due Date&quot; column to a dataset using the expression property, but I am having trouble with the syntax. &#160;Due date needs to be calculated by subtract Read More

Views

18

Votes

0

Answers

3

August 15, 2011

Crystal Reports - add # to DateTime field

Hi, I am trying to add Payment Terms to my report. I have Invoice date which is DateTime field and I have Terms which is Number I need a Due_Date = Invoice_date + terms; The problem I have is Invoice_ Read More

Views

18

Votes

0

Answers

4

August 16, 2011

Where to set the display date format in asp and SQL? <% date() %> dd/mm/yyyy and mm/dd/yyyy

Dear Expert, I have been hitting problems everytime when I migrate my asp code from a one server to another server where the following get date asp code return different format. &lt;% date() %&gt; for Read More

Views

8

Votes

0

Answers

3

August 16, 2011

sql statement :: datetime filtering

:: The problem datetime filter is returning for example only 3 records that are dated today or earlier -- yet I know there are 6 applicable records. I suspect -- the 1st records may have been recorded Read More

Views

15

Votes

0

Answers

3

August 16, 2011

Date problem

I get the following error because my ordr[&quot;DATE_OUT&quot;] is blank/NULL in the database (ORACLE): &quot;Specified cast is not valid.&quot; How can I fix this? Thx. if (ordr.Read()) Read More

Views

0

Votes

0

Answers

10

August 16, 2011