Whoops... sorry about the formatting forgot to break the <HTML> tags for
those with HTML email programs.
Question was how do i get this example to work so i can see what it is doing?
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.
Code:
<CFTRY>
<----------------------------------------------------------------------
Initialize commitIt to Yes.
----------------------------------------------------------------------->
<CFSET commitIt = "Yes">
<CFTRANSACTION ACTION="BEGIN">
<CFQUERY NAME='makeNewCourse' DATASOURCE='cfsnippets'>
INSERT INTO Courses
(Number, Descript)
VALUES
('#myNumber#', '#myDescription#')
</CFQUERY>
<!------------------------------------------------------------------
Rolls back the pending insertion if database exception is caught.
------------------------------------------------------------------->
<CFCATCH TYPE="DATABASE">
<CFTRANSACTION ACTION="ROLLBACK"/>
<CFSET commitIt = "No">
</CFCATCH>
<CFIF commitIt>
<CFTRANSACTION ACTION="COMMIT"/>
<!--------------------------------------------------------------
Commits the pending insertion.
---------------------------------------------------------------->
<CFELSE>
<CFSET commitIt="Yes">
</CFIF>
<CFQUERY NAME='insertNewCourseToList' DATASOURCE='cfsnippets'>
INSERT INTO CourseList
(CorNumber, CorDesc, Dept_ID,
CorName, CorLevel, LastUpdate)
VALUES
('#myNumber#', '#myDescription#', '#myDepartment#',
'#myDescription#', '#myCorLevel#', #Now()#)
</CFQUERY>
<!------------------------------------------------------------------
Rolls back the pending insertion if database exception is caught.
------------------------------------------------------------------->
<CFCATCH TYPE="DATABASE">
<CFTRANSACTION ACTION="ROLLBACK"/>
<CFSET commitIt = "No">
</CFCATCH>
<CFIF commitIt>
<CFTRANSACTION ACTION="COMMIT"/>
<!--------------------------------------------------------------
Commits the pending insertion.
---------------------------------------------------------------->
<CFELSE>
<CFSET commitIt="Yes">
</CFIF>
</CFTRANSACTION>
</CFTRY>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists