I don't know about MySQL, but you are asking for trouble if you do that in
Oracle since blank date fields are interpreted as a real date. You should
do this:
newDate = form.dueDate
if NOT isdate(newDate)
newDate = "NULL"
UPDATE JOBINFO
SET TICKETSTATUS = '#FORM.TICKETSTATUS#',
DUEDATE = #newDate#,
JOBNUM = #FORM.JOBNUM#,
PONUMBER = '#FORM.PONUMBER#'
WHERE JOBID = #FORM.JOBID#
Bryan Love ACP
Internet Application Developer
Telecommunication Systems Inc.
[EMAIL PROTECTED]
-----Original Message-----
From: Chad Gray [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2001 9:31 AM
To: CF-Talk
Subject: MySQL and Dates
Im running into another strange thing im not use to with MySQL.
If im doing an UPDATE on a record i have to add logic to DateTime Fields.
<CFQUERY datasource="foo" name="insert">
UPDATE JOBINFO
SET TICKETSTATUS = '#FORM.TICKETSTATUS#',
DUEDATE = <CFIF FORM.DUEDATE IS
"">'#FORM.DUEDATE#',<CFELSE>#FORM.DUEDATE#,</CFIF>
JOBNUM = #FORM.JOBNUM#,
PONUMBER = '#FORM.PONUMBER#'
WHERE JOBID = #FORM.JOBID#
</CFQUERY>
If the Variable for the DateTime Field is left blank then i have to
surround the Variable with single quotes. IF the variable is given a value
then i cant use the single quotes.
Am i doing something wrong, or is this the way it has to be with MySql
DateTime fields?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists