What database are you using? The problem may be that your database is
expecting the date in a specific format. Using Oracle as an example, the
value you are trying to insert into the Date column, '#onedate#', would be
seen as a string and not a date which would generate an error. Oracle has a
TO_DATE function that will convert the string to a date format. Check to
make sure the format is recognizable by the database you are using and also
check if the date string needs to be converted before inserting.

Erik

----- Original Message -----
From: "megan sherman" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, May 09, 2001 10:01 AM
Subject: syntax error when inserting date


> Hi all,
> My action template is supposed to insert classID, location and date into
> a table in my database. When creating new records in the form I provide,
> I want the user to be able to supply a comma delimited list of dates. I
> think the loop in the action template successfully extracts individual
> dates from the date list, but there is a syntax error in the insert
> command. Everything works if I don't try to insert the date, so that
> must be where the syntax error occurs. Can anybody tell me what my date
> syntax error is?
> Thanks in advance!
> Megan
> <<<The action template code is shown below>>>
> <CFIF IsDefined("FORM.scheduleID")>
>  <CFUPDATE DATASOURCE="calkayak" TABLENAME="class_schedule">
> <CFELSE>
> <cfoutput>
> <cfset dategroup=form.date>
> <cfloop index="x" from=1 to=#ListLen(dategroup)#>
> <cfset onedate=ListGetAt(dategroup,#x#)>
> <cfquery datasource="calkayak">
> insert into class_schedule (classID, location, date)
> values(#form.classID#, '#form.location#', '#onedate#')
> </cfquery>
> </cfloop>
> </cfoutput>
> </CFIF>
>
>
> Archives: http://www.mail-archive.com/[email protected]/
> Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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