Remember that date is a key word in sql and will produce undesired results
if a field in a table is named date as in your code snippet.
insert into class_schedule (classID, location, date)
Try changing the field name to aDate or lastupdated or something.
Bryan
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, May 09, 2001 3:06 PM
Subject: RE: syntax error when inserting date
> Your problem is most likely due to the format of the date.
> If the data field in the database is of type 'Date' you would have to use
> CreateODBCDate(Form.Date) in order to change the text to an ODBC date
> format.
>
> Regards,
>
> Rob Rusher
>
> Spectra Architect, Certified ColdFusion Instructor + Developer, Certified
> Java Programmer
>
> email: [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]> phone: 303-885-7044
>
> plan, build and integrate interactive applications and e-business services
> to enhance knowledge sharing, e-commerce and business communications
> initiatives
>
>
>
> -----Original Message-----
> From: megan sherman [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 09, 2001 8:02 AM
> To: CF-Talk
> 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