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/[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.
------------------------------------------------------------------------------
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.