Sorry it's taken me so long to respond; I'm cleaning out my mail client, and
finding all kinds of stuff at the bottom.

> > > In one of my pages I have a few insert queries that I run
> > > inside of a cftransaction. Depending on the results I did
> > > have a cflocation tag to redirect them to a outcome page.
> > > They would get redirected fine, but the insert queries
> > > would not run properly, as in they wouldn't write to the
> > > table. Is this because the cflocation has the ability to
> > > break a cftransaction block????
> > 
> > Yes, when CFLOCATION is processed, nothing else in that 
> > page following the CFLOCATION is processed.
> 
> I've been struggling with the same problem. I want to perform 
> an update or an insert, then redirect the user to another page. 
> Can you outline a strategy for accomplishing this? Should I just 
> remove the <cftransaction>? Although this seems like it would work, 
> I wouldn't be able to get the result I want. That is, I don't want 
> to move the user forward UNLESS the insert or update has been 
> successful.
> 
> One other thing. With this setup, I increment my autonumber field 
> for inserts, but there is no record created in the table.

One alternative is to move your transaction processing to the database using
stored procedures. You could, for example, have one big stored procedure
which handles all of the insert data at once - perhaps by calling other
stored procedures to perform the individual insertions. Once completed, your
stored procedure could return a code which could represent whether the
transaction succeeded or failed.

Or, if you want to do this within CF, you could have some token which you
use to mark the success of a transaction. Perhaps it's a trigger on the last
table within your transaction which returns a value when you insert
successfully. You could then check for that value using a CFIF below your
CFTRANSACTION block to determine whether to redirect or not.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
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.

Reply via email to