Can I perform the actual database operations in routines by calling them inside the TransactionScope block if my connection objects are declared at module level?Code:Public Sub PerformDBWork() Try Using scope As New TransactionScope Using cnBusinessDB 'Open connection to Business DB cnBusinessDB.Open() 'Do Business operations DelAnyExistingAddress(UserID) InsertAddress() Using cnFinancialDB 'Open connection to Financial DB cnFinancialDB.Open() 'Do Financial operations InsertPOHeaderRecord() InsertPODetailsRecords() End Using End Using scope.Complete() End Using Catch txnEx As TransactionAbortedException RaiseEvent Transaction_Failure(MSG_TXN_ABORTED.Replace("%1", txnEx.Message.ToString())) Catch ex As Exception RaiseEvent Unknown_Exception(MSG_UNEXPECTED_ISSUE.Replace("%1", ex.Message.ToString())) End Try End Sub
Cheers.




Reply With Quote