How about if you make the unused fields on your form invisible and give them
a value which you can detect on your processing page and set them to null. A
little more work on the form generation side.

Another way to do it is to use a set if Isdefined("Form.Adresses_X")  on the
processing page and set the ones that are not defined to "Null".

----- Original Message -----
From: "Brunt, Michael" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, April 02, 2002 6:13 PM
Subject: Dynamic Insert Query Issue


> This is difficult to explain but I will try my best.  I have an Insert
Query
> which will be passed a list of values from a form.  This form is
dynamically
> generated from a previous query result set so by the time the form is
> generated we know the number of records returned used for building the
form.
> Once the user has entered information in the form and submitted it  the
> insert query has to behave like this: -
>
> <cfquery name="qinssvceaddr" datasource="#request.DSN#" dbtype="odbc">
> INSERT INTO #request.TBCR#TN0987
> ADDR_ID_001,
>        ADDR_ID_002,
>        ADDR_ID_003,
>        ADDR_ID_004,
>        ADDR_ID_005,
>        ADDR_ID_006,
>        ADDR_ID_007,
>        ADDR_ID_008 (this carries on up to 100)
> VALUES
>        #form.addressID# (once again we have 100 fields in the db and for
> example in the case where there are 5 values passed to this query from the
> form we have make the remaining 95 values be null and this will vary
> dependant on the number of form values past.  So again if there are 20
> form.addressID's passed we would have to dynamically set the remaining 80
> values in the Insert to null.
>
> Hope I explained this well, can anyone help?
>
> Mike Brunt
> Sempra Energy
> 213.244.5226
>
> "A logician trying to explain logic to a programmer is like a cat trying
to
> explain to a fish what it's like to get wet."
>
>
> 
______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to