CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 ASP, ADO, and Transactions

Print topic Send  topic

Author Message
marcwolf


Posts: 361
Posted: 04/12/2005, 8:13 PM

Hi all.. This is NOT a help question, but a quick HowTo for those who need to use transactions within CCS

I had a need where I wanted to roll back the add of a record if a condition was met. After much investigation I found out how to do it but the object trail was pretty complex so I decided to post it here for others to use.

Firstly and most importantly - make sure that the 'Disable transaction' in your ODBC link is unchecked.

Next in the form's BeforeExecuteInsert put the following

formname.command.connection.connection.begintrans

Then in the form's AfterExecuteInsert do this

  
If errors> 0 then  
   formname.errors.adderror "errors have occured"  
   formname.command.connection.connection.rollbacktrans  
else  
   formname.command.connection.connection.committrans  
end if  

Now - before the errors test you can do all sorts of inserts/updates/deletes etc and only if all of them have passed then - commit or rollback.

Accessing the form's error collection just adds to the details returned to the viewer, and has nothing to do with the actual rollback operation.

I hope this helps someone as it took me a while to transverse all of the objects and their inheritances.

Take Care

Dave
_________________
' Coding Coding Coding
Keep Those Keyboards Coding.
Raw Code!!!!!!!
View profile  Send private message
eiden


Posts: 34
Posted: 04/12/2005, 9:44 PM

Thanks marcwolf!

Good work :-)
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.