<p>I did some tests a while ago and never figured out how to make this work.  </p>

<p><strong>The ingredients:</strong></p>

<ul>
<li>COM+ transactional object (developed in VB6)  </li>
<li>.Net web application (with transaction) in IIS that...<br>
makes a call to the COM+ component<br>
updates a row in a SQL database</li>
</ul>

<p><strong>Testing:</strong>  </p>

<p>Run the .Net application and force an exception.  </p>

<p><strong>Result:</strong>  </p>

<p>The update made from the .Net application rolls back.<br>
The update made by the COM+ object does not roll back.</p>

<p>If I call the COM+ object from an old ASP page the rollback works.</p>

<p>I know some people may be thinking "what?! COM+ and .Net you must be out of your mind!", but there are some places in this world where there still are a lot of COM+ components. I was just curious if someone ever faced this and if you figured out how to make this work.</p>

[{'answer_id': 21599, 'author': 'Eric Z Beard', 'author_id': 1219, 'author_profile': 'https://Stackoverflow.com/users/1219', 'pm_score': 1, 'selected': False, 'text': "<p>How are you implementing this?  If you are using EnterpriseServices to manage the .NET transaction, then both transactions should get rolled back, since you're using the same context for them both.</p>\n"}, {'answer_id': 66513, 'author': 'Euro Micelli', 'author_id': 2230, 'author_profile': 'https://Stackoverflow.com/users/2230', 'pm_score': 3, 'selected': True, 'text': '<p>Because VB and .NET will use different SQL connections (and there is no way to make ADO and ADO.NET share the same connection), your only possibility is to enlist the DTC (Distributed Transaction Coordinator). The DTC will coordinates the two independent transactions so they commit or are rolled-back together.</p>\n\n<p><strong>From .NET</strong>, EnterpriseServices manages COM+ functionality, such as the DTC. In .NET 2.0 and forward, you can use the System.Transactions namespace, which makes things a little nicer. I think something like this should work (untested code):</p>\n\n<pre><code>void SomeMethod()\n{\n    EnterpriseServicesInteropOption e = EnterpriseServicesInteropOption.Full;\n    using (TransactionScope s = new TransactionScope(e))\n    {\n        MyComPlusClass o = new MyComPlusClass();\n\n        o.SomeTransactionalMethod();\n    }\n}\n</code></pre>\n\n<p>I am not familiar enough with this to give you more advice at this point.</p>\n\n<p><strong>On the COM+ side</strong>, your object needs to be configured to use (most likely "require") a distributed transaction. You can do that from COM+ Explorer, by going to your object\'s <em>Properties</em>, selecting the <em>Transaction</em> tab, and clicking on "<em>Required</em>". I don\'t remember if you can do this from code as well; VB6 was created before COM+ was released, so it doesn\'t fully support everything COM+ does (its transactional support was meant for COM+\'s predecessor, called MS Transaction Server).</p>\n\n<p>If everything works correctly, your COM+ object should be enlisting in the existing Context created by your .NET code.</p>\n\n<p>You can use the "Distributed Transaction Coordinator\\Transaction List" node in "Component Services" to check and see the distributed transaction being created during the call.</p>\n\n<p>Be aware that you cannot see the changes from the COM+ component reflected on data queries from the .NET side until the Transaction is committed! In fact, it is possible to deadlock! Remember that DTC will make sure that the two transactions are paired, but they are still separate database transactions.</p>\n'}]
['https://Stackoverflow.com/questions/21589', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1328/']