> There is an error in the example code that comes with the 
> CFStudio help file for CFTRANSACTION. I get this error: 
> Context validation error in tag CFTRY The tag is not 
> correctly positioned relative to other tags in the template: 
> the last tag nested inside tag CFTRY must be a CFCATCH tag. 
> Currently it is a CFTRANSACTION tag. The error occurred while 
> processing an element with a general identifier of (CFTRY), 
> occupying document position (27:1) to (27:7). How would i 
> fix the code so it works right?

In my opinion, unless I'm missing something, that code sample is completely
screwed up. The primary use of CFTRANSACTION is to treat multiple queries as
a single operation within the database. In the code sample, if the first
query succeeds, it'll be committed, and if the second one succeeds, it'll be
committed separately. In that case, you might as well do away with the
CFTRANSACTION entirely, and simply wrap each query in a separate
CFTRY/CFCATCH block:

<cftry>

        <cfquery name="makeNewCourse" ...>
        ...
        </cfquery>

        <cfcatch type="database">
        <!--- do nothing and let the page continue processing --->
        </cfcatch>

</cftry>

<cftry>

        <cfquery name="insertNewCourseToList" ...>
        ...
        </cfquery>

        <cfcatch type="database">
        <!--- do nothing and let the page continue processing --->
        </cfcatch>

</cftry>

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to