Turn on debugging and output the query; you'll see what values are actually
being passed to the db by cold fusion.  

You may have some luck if you make convert your form.date value to an
ODBCDate object (see createODBCDate function).

You could also try using the SQL CONVERT function to convert your text date
into a SQL date object, then do the comparison.

Or you could compare CONVERT(char,EventDate,101) with form.date.

Take a look at CONVERT.

-----Original Message-----
From: Chris Martin [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 04, 2000 1:19 PM
To: CF-Talk
Subject: Problem Matching Dates


Hey everyone.  I am working with sql server, and I am trying to match a date
to update a record.  Here is what I have:

<cfquery name="qcfAddEventDates" datasource="FSLibrary_Dev">
        UPDATE          dbo.tbl_EP_EventDateTime
        SET                     EventDateStartTime = #local.startTime#,
EventDateEndTime =
#local.endTime#, EventScheduleNotes = '#Trim(form.dateNotes)#'
        WHERE           EventID = #Trim(form.ID)#
        AND                     DatePart(DD, EventDate) = DatePart(DD,
#Trim(form.Date)#)
        AND                     DatePart(MM, EventDate) = DatePart(MM,
#Trim(form.Date)#)
</cfquery>

I also tried:

<cfquery name="qcfAddEventDates" datasource="FSLibrary_Dev">
        UPDATE          dbo.tbl_EP_EventDateTime
        SET                     EventDateStartTime = #local.startTime#,
EventDateEndTime =
#local.endTime#, EventScheduleNotes = '#Trim(form.dateNotes)#'
        WHERE           EventID = #Trim(form.ID)#
        AND                     EventDate = #Trim(form.Date)#
</cfquery>
The problem is that it won't match any records.  I know the record is in the
database, because I checked to make sure.  Any ideas why this doesn't work?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to