You are doing multiple inserts so you should do multiple queries...
Try something like:
<cfset listregion = "Africa,Africa,Africa">
<cfset Cats = "5, 10, 15">
<cfset listmonth = "May, May, May">
<cfloop index="loopinx" from="1" to="#listlen(listregion)#">
<cfquery datasource="GOE">
INSERT INTO Testgoe(Region, ExpenseID);
VALUES ('#listgetat(listregion,loopinx)#', #listgetat(cats,loopinx)#)
</cfquery>
</cfloop>
HTH,
Howie Hamlin
--
inFusion Project Manager; On-Line Data Solutions, Inc. (631)737-4668
===================================================
Please vote for iMS in the Most Innovative category here:
*** http://www.sys-con.com/ColdFusion/readerschoice2000/ ***
===================================================
Check out inFusion Mail Server - the world's most configurable email server
*** inFusion Authenticator for IIS is now released! (download from
CoolFusion.com) ***
http://www.teletrends.com and http://www.coolfusion.com
Software and utilities for ColdFusion, iHTML, Website, NTMail
Latest versions available from our web site (inFusion Authenticator version
2.0 for WebSite and NTMail is now released)
----- Original Message -----
From: Harper, Laura <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, April 07, 2000 3:21 PM
Subject: CFLoop w/Insert Into??
> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
>
> ------_=_NextPart_001_01BFA0C6.7E6C9FC0
> Content-Type: text/plain;
> charset="iso-8859-1"
>
> Hello everyone,
>
> I have a looping problem that I can't quite get!
>
> I have 5 lists as follows:
> region = "Africa, Africa, Africa"
> ID = "5, 10, 15"
> month = "May, May, May"
> proj_amt = "120, 200, 4000"
> budget_amt = "200, 230, 5000"
>
> This data is coming from user input from a previous page and then gets
> inserted into a DB. So, each record will be region, ID, month, proj_amt,
> budget_amt.
> There is logic as to why region and month have the same elements.
>
> To make it easier I'm showing my code for the first three lists:
> <cfset listregion = "Africa,Africa,Africa">
> <cfset Cats = "5, 10, 15">
> <cfset listmonth = "May, May, May">
>
> <cfquery name="Insert_Budget" datasource="GOE">
> <cfloop index="a" list="#variables.listregion#">
> <cfloop index="b" list="#variables.Cats#">
> INSERT INTO Testgoe(Region, ExpenseID);
> VALUES ('#Evaluate('a')#', #Evaluate(b)#)
> </cfloop>
> </cfloop>
> </cfquery>
> And the erroe I get is:
> ODBC Error Code = 37000 (Syntax error or access violation)
> [Microsoft][ODBC Microsoft Access 97 Driver] Syntax error in INSERT INTO
> statement.
> SQL = "INSERT INTO Testgoe(Region, ExpenseID); VALUES ('Africa', 5) INSERT
> INTO Testgoe(Region, ExpenseID);
> VALUES ('Africa', 10) INSERT INTO Testgoe(Region, ExpenseID); VALUES
> ('Africa', 15) INSERT INTO
> Testgoe(Region, ExpenseID); VALUES ('Africa', 5) INSERT INTO
Testgoe(Region,
> ExpenseID);
> VALUES ('Africa', 10) INSERT INTO Testgoe(Region, ExpenseID); VALUES
> ('Africa', 15)
> INSERT INTO Testgoe(Region, ExpenseID); VALUES ('Africa', 5) INSERT INTO
> Testgoe(Region, ExpenseID);
> VALUES ('Africa', 10) INSERT INTO Testgoe(Region, ExpenseID); VALUES
> ('Africa', 15)"
> Data Source = "GOE"
> The error occurred while processing an element with a general identifier
of
> (CFQUERY), occupying document position (29:1) to (29:47).
> And why is it looping twice? I've tried millions of variations. <cf-tThis
is
> driving me nuts!! But I'm sure you've heard that before. Your help is
> greatly appreciated.
>
> Laura
>
>
>
>
>
> ------_=_NextPart_001_01BFA0C6.7E6C9FC0
> Content-Type: text/html;
> charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
> <HTML>
> <HEAD>
> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
> charset=3Diso-8859-1">
> <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
> 5.5.2651.75">
> <TITLE>CFLoop w/Insert Into??</TITLE>
> </HEAD>
> <BODY>
>
> <P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">Hello everyone,</FONT>
> </P>
>
> <P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">I have a looping =
> problem that I can't quite get! </FONT>
> </P>
>
> <P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">I have 5 lists as =
> follows:</FONT>
> <BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">region =3D =
> "Africa, Africa, Africa"</FONT>
> <BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">ID =3D "5, 10, =
> 15"</FONT>
> <BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">month =3D "May, =
> May, May"</FONT>
> <BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">proj_amt =3D =
> "120, 200, 4000"</FONT>
> <BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">budget_amt =3D =
> "200, 230, 5000" </FONT>
> </P>
>
> <P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">This data is coming =
> from user input from a previous page and then gets inserted into a =
> DB. So, each record will be region, ID, month, proj_amt, =
> budget_amt. </FONT></P>
>
> <P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">There is logic as to =
> why region and month have the same elements.</FONT>
> </P>
>
> <P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">To make it easier I'm =
> showing my code for the first three lists:</FONT>
> <BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow"><cfset listregion =
> =3D "Africa,Africa,Africa"></FONT>
> <BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow"><cfset Cats =3D =
> "5, 10, 15"></FONT>
> <BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow"><cfset listmonth =
> =3D "May, May, May"></FONT>
> </P>
>
> <P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow"><cfquery =
> name=3D"Insert_Budget" =
> datasource=3D"GOE"></FONT>
> <BR> <FONT COLOR=3D"#000080" =
> FACE=3D"Arial Narrow"><cfloop index=3D"a" =
> list=3D"#variables.listregion#"></FONT>
> <BR> =
> <FONT COLOR=3D"#000080" =
> FACE=3D"Arial Narrow"><cfloop index=3D"b" =
> list=3D"#variables.Cats#"></FONT>
> <BR> =
> <FONT COLOR=3D"#000080" =
> FACE=3D"Arial Narrow">INSERT INTO Testgoe(Region, ExpenseID);</FONT>
> <BR> =
> <FONT COLOR=3D"#000080" =
> FACE=3D"Arial Narrow">VALUES ('#Evaluate('a')#', =
> #Evaluate(b)#) </FONT>
> <BR> <FONT COLOR=3D"#000080" =
> FACE=3D"Arial Narrow"> =
> </cfloop></FONT>
> <BR> <FONT COLOR=3D"#000080" =
> FACE=3D"Arial Narrow"></cfloop></FONT>
> <BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow"></cfquery> =
> </FONT>
> <BR><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">And the erroe I get =
> is:</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Times New Roman">ODBC Error Code =3D 37000 =
> (Syntax error or access violation) </FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Times New Roman">[Microsoft][ODBC Microsoft =
> Access 97 Driver] Syntax error in INSERT INTO statement. </FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Times New Roman">SQL =3D "INSERT INTO =
> Testgoe(Region, ExpenseID); VALUES ('Africa', 5) INSERT INTO =
> Testgoe(Region, ExpenseID);</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Times New Roman">VALUES ('Africa', 10) =
> INSERT INTO Testgoe(Region, ExpenseID); VALUES ('Africa', 15) INSERT =
> INTO </FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Times New Roman">Testgoe(Region, ExpenseID); =
> VALUES ('Africa', 5) INSERT INTO Testgoe(Region, ExpenseID); </FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Times New Roman">VALUES ('Africa', 10) =
> INSERT INTO Testgoe(Region, ExpenseID); VALUES ('Africa', 15)</FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Times New Roman">INSERT INTO Testgoe(Region, =
> ExpenseID); VALUES ('Africa', 5) INSERT INTO Testgoe(Region, =
> ExpenseID); </FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Times New Roman">VALUES ('Africa', 10) =
> INSERT INTO Testgoe(Region, ExpenseID); VALUES ('Africa', 15)" =
> </FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Times New Roman">Data Source =3D =
> "GOE" </FONT>
> <BR><FONT SIZE=3D2 FACE=3D"Times New Roman">The error occurred while =
> processing an element with a general identifier of (CFQUERY), occupying =
> document position (29:1) to (29:47). </FONT></P>
>
> <P><FONT COLOR=3D"#000080" FACE=3D"Arial Narrow">And why is it looping =
> twice? I've tried millions of variations. <cf-tThis is driving me =
> nuts!! But I'm sure you've heard that before. Your help is =
> greatly appreciated.</FONT></P>
>
> <P><B><I><FONT COLOR=3D"#800080" SIZE=3D2 =
> FACE=3D"Arial">Laura</FONT></I></B><I></I>
> </P>
> <BR>
> <BR>
> <BR>
>
> </BODY>
> </HTML>
> ------_=_NextPart_001_01BFA0C6.7E6C9FC0--
> --------------------------------------------------------------------------
----
> Archives: http://www.eGroups.com/list/cf-talk
> 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.eGroups.com/list/cf-talk
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.