Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The problem is that when you open a second connection in the same transaction scope, an attempt is made to promote the transaction to a distributed transaction (even though there's nothing distributed about it since you connect to the same database). SQL Server CE doesn't support this scenario.</p> <p>What I would do is create a custom 'container' activity that opens (and closes) the connection and makes it available to child activities. This is still not optimal but at least you no longer need to pass <code>InArgument</code>'s around. You get the following activity tree:</p> <pre><code>TransactionScope InitializeConnection Sequence CustomDataActivity1 CustomDataActivity2 CustomDataActivity3 </code></pre> <p><code>InitializeConnection</code> is a <a href="http://msdn.microsoft.com/en-us/library/system.activities.nativeactivity.aspx" rel="nofollow"><code>NativeActivity</code></a> that uses <a href="http://msdn.microsoft.com/en-us/library/system.activities.nativeactivitycontext.properties.aspx" rel="nofollow"><code>NativeActivityContext.Properties</code></a> to expose the connection (or the <code>ObjectContext</code>) to child activities.</p> <p>Make sure you implement proper error handling to ensure you close the connection at all times.</p> <p><strong>NOTE</strong>: Distributed transactions are supported by the full SQL Server only through a Windows service called <a href="http://technet.microsoft.com/en-us/library/cc771686%28WS.10%29.aspx" rel="nofollow">MSDTC</a> (Microsoft Distributed Transaction Coordinator). You can find this one in your 'Local Services'. Since SQL Server CE is a database that should be able to operate completely standalone, it makes sense that it has no dependency on MSDTC. Therefore it has no support for distributed transactions.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload