[thelist] NYC/DC Tragedy
Joshua Olson
joshua at alphashop.net
Thu Sep 13 13:11:25 CDT 2001
Jeff,
Er, uh. This does not work in every database. For example, it does not
work in Access/Jet. If you try to do it, it says you need a semicolon. So
you add the semicolon, and it says that there is an extra semicolon.
Frank Hilliard pointed this out to me just yesterday as a matter of fact.
-joshua
----- Original Message -----
From: ".jeff" <jeff at members.evolt.org>
Subject: RE: [thelist] NYC/DC Tragedy
: <tip author=".jeff" type="ColdFusion">
:
: have a bunch of insert queries you need to run at once? don't open and
: close a connection for each one if you don't have to (ie, if your database
: server supports the following method). instead, throw them all into one
: query.
:
: so, instead of this:
:
: <cfloop list="#form.registrants#" index="i">
: <cfquery ...>
: INSERT INTO table_name (...)
: VALUES (...)
: </cfquery>
: </cfloop>
:
: try this:
:
: <cfif ListLen(form.registrants)>
: <cfquery ...>
: <cfloop list="#form.registrants#" index="i">
: INSERT INTO table_name (...)
: VALUES (...)
: </cfloop>
: </cfquery>
: </cfif>
:
: or, even this, if your database supports it:
:
: <cfif ListLen(form.registrants)>
: <cfquery ...>
: INSERT INTO table_name (...)
: VALUES
: <cfloop list="#form.registrants#" index="i">
: <cfif i NEQ ListFirst(form.registrants)>, </cfif>
: (...)
: </cfloop>
: </cfquery>
: </cfif>
:
: </tip>
More information about the thelist
mailing list