Michael
Have you tried using the temporary variables in your INTO clause
as well as in your VALUES clause?
Nick

-----Original Message-----
From: Michael Gagnon [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 28, 2000 7: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>


**********************************************************************
Information in this email is confidential and may be privileged. 
It is intended for the addressee only. If you have received it in error,
please notify the sender immediately and delete it from your system. 
You should not otherwise copy it, retransmit it or use or disclose its
contents to anyone. 
Thank you for your co-operation.
**********************************************************************
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
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