DataPortal_Insert and Transactions

DataPortal_Insert and Transactions

Old forum URL:

jfreeman posted on Friday, November 12, 2010

I have a BusinessBase object that shows data from a couple of different tables.  Right now when I do an Insert, I call one stored proc and it determines what tables to insert into.  I'd like to move that logic into the DataPortal_Insert and make multiple stored procedure calls based on what data is on the object.  I'd also like all the stored procs to be in a Transaction, so if one fails they all rollback.  Is that possible?  Any samples of how to make the transaction work?  Thanks.


RockfordLhotka replied on Friday, November 12, 2010

Chapter 18 of Expert 2008 Business Objects talks about data access in some depth.

The short answer, is that you can just put a Transactional attribute on your DataPortal_Insert method and tell it to use a TransactionScope transaction.

If you do this however, you must understand that your code will be running in a System.Transactions.TransactionScope, and all the rules and nuances of using a TransactionScope come into play. Obviously that's all standard .NET, so you can find info about that in many places, including Chapter 18.

Copyright (c) Marimer LLC