> <CFSET Date=#Dateformat(CreateODBCDate(Form.Date), "mm/dd/yy")#>
> <CFSET EndDate=#Dateformat(CreateODBCDate(Form.EndDate),
> "mm/dd/yy")#>
> <CFSET Time=#Timeformat(CreateODBCTime(Form.Time), "HH:mm:ss")#>
1. You can not insert fomatted dates into a database. Format them after
you read from the database.
2. What is the field type of the "Time" field?
> <CFIF isdefined("Form.EndTime")>
> <CFSET EndTime=#Timeformat(CreateODBCTime(Form.EndTime),
> "HH:mm:ss")#>
> <CFELSE>
> <CFSET EndTime=#Timeformat(CreateODBCTime(0), "HH:mm:ss")#>
> </CFIF>
>
> <CFQUERY datasource="intranet">
> INSERT INTO Events (Date, EndDate, Time, EndTime, Venue, Desc,
> Attendees, Category)
> VALUES (#Date#, #EndDate#, #Time#, #EndTime#, #Form.Venue#,
> #Form.Desc#, #Form.Attendees#, #Form.Category#)
> </CFQUERY>
3. Your Form.Venue, Form.Desc, Form.Attendees and Form.Category need to be
enclosed in single quotes.
Again, here's the suggestion:
<cfquery name="AddIn" datasource="intranet">
insert into Events (Date, EndDate, Time, EndTime, Venue, Desc, Attendees,
Category)
values
(#CreateODBCDate(Form.Date)#, #CreateODBCDate(Form.EndDate)#,
#CreateODBCTime(Form.Time)#, #CreateODBCTime(Form.EndTime)#, '#Form.Venue#',
'#Form.Desc#', '#Form.Attendees#', '#Form.Category#')
</cfquery>
HTH
Hatton
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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