You're using reserved words as field names (date, time,desc).  Try putting square 
braces around them like:

INSERT INTO Events ([Date], EndDate, [Time], EndTime, Venue, [Desc]

Or - better still, change the field names in the database.

HTH,

Howie Hamlin - inFusion Project Manager
On-Line Data Solutions, Inc.
www.CoolFusion.com
631-737-4668 x101
inFusion Mail Server (iMS) - The Intelligent Mail Server
Join the DevCon community at www.coolfusion.com/devcon

----- Original Message ----- 
From: "Dusty Tinashe Shoko" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, August 31, 2001 9:35 AM
Subject: Re: SQL


> Thanks guys here is the error msg
> 
> ODBC Error Code = 37000 (Syntax error or access violation)
> [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
> statement.
> The error occurred while processing an element with a general identifier of
> (CFQUERY), occupying document position (59:9) to (59:40).
> 
> and here is the code snippet
>         <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")#>
>         <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>
> 
> 
> ----- Original Message -----
> From: Andrew Scott <[EMAIL PROTECTED]>
> To: CF-Talk <[EMAIL PROTECTED]>
> Sent: Friday, August 31, 2001 3:04 PM
> Subject: RE: SQL
> 
> 
> > Yes it is, but if the field is an int then you will have to remove the '
> > .
> >
> > It may pay to post the error message so that we can identify the exact
> > problem:-)
> >
> >
> > Regards,
> > Andrew Scott
> >
> >
> > -----Original Message-----
> > From: Dusty Tinashe Shoko [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, 31 August 2001 11:06 PM
> > To: CF-Talk
> > Subject: SQL
> >
> > People help
> > <CFQUER datasource="mydbsource">
> >     INSERT INTO TABLENAME (Field1, Field2, Field3,....)
> >     VALUES ('Value1', 'Value2', 'Value3',...)
> > </CFQUERY>
> >
> > Is that the proper syntax?
> > Sp Field1 is a date got from the form how would I make sure it is
> > inserted in a format I like? Can I do a dateformat within the query?
> > I am getting a syntax error!
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

Reply via email to