I mean output to the page to verify what statement you're creating.

(It just occurs to me that your line breaks may be causing a problem; you
either need to use continuation characters on put the fields list and values
list stuff on single lines.)



<CFOUTPUT>
  INSERT INTO Projects (ProjectID,ID,Done
  <cfloop
query="lang">,Description#lang.Abrev#,details#lang.Abrev#,</cfloop>
  Image,FormatImage)
  VALUES(#ProjectID#,#ID#,#Done#,
  <cfloop query="lang">
  <CFSET tempdesc=evaluate('Description#lang.Abrev#')>
  <CFSET tempdet=evaluate('details#lang.Abrev#')>
  ,'#tempdesc# ','#tempdet# ',</cfloop>
   Image='#Image#',
   FormatImage='#formatImage#')
</CFOUTPUT>

-----Original Message-----
From: Michael Gagnon [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 29, 2000 9:38 AM
To: CF-Talk
Subject: Re: INSERT INTO with loop problem


What do you meen by outputing the SQL statements?

Here's where I'm at now:

<CFquery datasource="CSM">
  INSERT INTO Projects (ProjectID,ID,Done
  <cfloop
query="lang">,Description#lang.Abrev#,details#lang.Abrev#,</cfloop>
  Image,FormatImage)
  VALUES(#ProjectID#,#ID#,#Done#,
  <cfloop query="lang">
  <CFSET tempdesc=evaluate('Description#lang.Abrev#')>
  <CFSET tempdet=evaluate('details#lang.Abrev#')>
  ,'#tempdesc# ','#tempdet# ',</cfloop>
   Image='#Image#',
   FormatImage='#formatImage#')
  </cfquery>


----- Original Message -----
From: "Hayes, David" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, September 29, 2000 11:23 AM
Subject: RE: INSERT INTO with loop problem


> You don't need single quotes around your field names portion ( use
> Description#lang.abrev# rather than 'Description#lang.abrev#') and put a
> comma after Done in your fields list.
>
> I would also recommend that you output the SQL statement you are creating
to
> make sure it looks right, all the commas and single quotes.
>
>
>
> -----Original Message-----
> From: Michael Gagnon [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 29, 2000 9:16 AM
> To: CF-Talk
> Subject: Re: INSERT INTO with loop problem
>
>
> Hi!
>
> I thoughtr that it worked, butr it didn't.
> (I had forgot to save my changes)
>
> I get the following error:
> [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO
> statement.
>
> ----- Original Message -----
> From: "Hayes, David" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Thursday, September 28, 2000 4:54 PM
> Subject: RE: INSERT INTO with loop problem
>
>
> > It might be the single quotes around everything; I'm assuming some of
the
> > fields you reference in your "INSERT INTO", such as ID, are numeric.
> >
> > Also, make sure you have a space after Projects; you show
> > Projects(ProjectID,...
> >
> > What behavior and/or error messages are you getting?
> >
> > -----Original Message-----
> > From: Michael Gagnon [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, September 28, 2000 1:04 PM
> > To: CF-Talk
> > Subject: INSERT INTO with loop problem
> >
> >
> > Hi!
> >
> > I used a CFQUERY to UPDATE a table and it works fine,
> > but I can't get it to work with an INSERT INTO.
> > I use the UPDATE instead of CFUPDATE beucause
> > of the loop.  I couldn't get it to work at all with CFUPDATE.
> >
> > Here it is:
> >
> > <CFquery datasource="CSM">
> >   INSERT INTO Projects(ProjectID,ID,Done<cfloop
> >
>
query="lang">,'Description#lang.abrev#','Details#lang.Abrev#',</cfloop>Image
> > ,FormatImage)
> >   VALUES('#ProjectID#','#ID#','#Done#'
> >   <cfloop query="lang">
> >   <CFSET tempdesc=evaluate("Description#lang.Abrev#")>
> >   <CFSET tempdet=evaluate("details#lang.Abrev#")>
> >   ,'#tempdesc# ','#tempdet# ',</cfloop>
> >    Image='#Image#',
> >    FormatImage='#formatImage#')
> >   </cfquery>
> >
> > Here is the working UPDATE:
> >
> > <CFQUERY datasource="CSM">
> >   UPDATE Projects
> >   SET
> >    <cfloop query="lang">
> >    <CFSET tempdesc=evaluate("Description#lang.Abrev#")>
> >    <CFSET tempdet=evaluate("details#lang.Abrev#")>
> >    Description#lang.Abrev#='#tempdesc# ',
> >    Details#lang.Abrev#='#tempdet# ',
> >    </cfloop>
> >    Done=#Done#,
> >    Image='#Image#',
> >    FormatImage='#formatImage#'
> >   WHERE ProjectID=#FORM.ProjectID#
> >   </cfquery>
> >


----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to