On 4/7/00, Jim Taylor penned:
>Let me try this again please.
>
>Is this the best way to handle a 2 table insert ?
The main reason to run a cftransaction is if the results from one
query are going effect the entry into another.
For instance:
1. Someone places and order and the order is written to the orders
table with an insert query in and the order id is incremented in an
autonumber field.
2. Now you need to write the individual items purchased into a line
items table. You pick up the order id from the orders table doing a
max(order_id) in your select query.
By placing the two queries inside a cftransaction tag, it will assure
that someone else doesn't insert an order in the instant between when
you insert yours and pick up the max(order_id). Otherwise, you would
place their order number into the line items record of the previous
order.
If you do it the other way, checking the max(order_id) and then
adding 1 and entering the order id into the orders table (in other
words, incrementing yourself as opposed to an autonumber field) then
it wouldn't be necessary as you'd pass that same number into the line
items table also.
HTH
Bud Schneehagen - Tropical Web Creations
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452
------------------------------------------------------------------------------
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.