Why can't petapoco4.0 transactions be rolled back?

Source: Internet
Author: User
Using (VAR srop = dbhelper. currentdb. gettransaction () {id = bp. addmodel (model ). tostr (); # region participate in the real estate information if (ID. toint32 ()> 0) {fy_activityprojectserver dtlserver = new fy_activityprojectserver (); For (INT I = 0; I <= This. projects. items. count; I ++) {If (this. projects. items [I]. selected) {fy_activityproject DTL = new fy_activityproject (); DTL. activityid = ID. toint32 (); DTL. projectid = This. projects. items [I]. value. toint32 (); DTL. isdel = false; dtllist. add (DTL) ;}} dtlserver. addmodel (dtllist) ;}# endregion srop. complete ();}

The above is the first method.

The second method is as follows:

Dbhelper. currentdb. begintransaction (); // The transaction starts this. modeldatacollect (); fy_activityserver BP = new fy_activityserver (); try {id = bp. addmodel (model ). tostr (); # region participate in the real estate information if (ID. toint32 ()> 0) {fy_activityprojectserver dtlserver = new fy_activityprojectserver (); For (INT I = 0; I <= This. projects. items. count; I ++) {If (this. projects. items [I]. selected) {fy_activityproject DTL = new fy_activityproject (); DTL. activityid = ID. toint32 (); DTL. projectid = This. projects. items [I]. value. toint32 (); DTL. isdel = false; dtllist. add (DTL) ;}} dtlserver. addmodel (dtllist) ;}# endregion dbhelper. currentdb. completetransaction ();} catch (exception) {dbhelper. currentdb. aborttransaction ();}

The preceding operations have two insert operations.

The first insert can be successfully inserted, and the second insert method intentionally reports an error,

The problem arises,

Petapoco does not roll back, causing the first operation to be successfully inserted and the second operation to be inserted to fail.

Solutions

Why can't petapoco4.0 transactions be rolled back?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.