title: .Net Framework Data Provider error 60
body: <p>I've received the following error from the live site:</p>
  
  <blockquote>
    <p>System.Web.HttpUnhandledException: Exception of type
    'System.Web.HttpUnhandledException' was thrown. --->
    System.InvalidOperationException: Internal .Net Framework Data
    Provider error 60. at
    System.Data.SqlClient.SqlDelegatedTransaction.Initialize() at
    System.Transactions.TransactionStatePSPEOperation.PSPEInitialize(InternalTransaction
    tx, IPromotableSinglePhaseNotification
    promotableSinglePhaseNotification) at
    System.Transactions.TransactionStateActive.EnlistPromotableSinglePhase(InternalTransaction
    tx, IPromotableSinglePhaseNotification
    promotableSinglePhaseNotification, Transaction atomicTransaction) at
    System.Transactions.Transaction.EnlistPromotableSinglePhase(IPromotableSinglePhaseNotification
    promotableSinglePhaseNotification) at
    System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction
    tx) ...</p>
  </blockquote>
  
  <p>Locally I cannot reproduce it.
  I don't get such errors every day but I need to understand and fix it. 
  From the logs I see that the piece of code where it happaned is:</p>
  
  <pre><code>           var transactionOptions = new System.Transactions.TransactionOptions();
             transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
  
             using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
              {
                  this.DataContext = new BMDataContext();// DataContext;
                  if (patientAdmissionID != -1)
                  {
                      PatientAdmission admission = queryAdmission(this.DataContext, patientAdmissionID);
  
                      transactionScope.Complete();
                      return admission;
                  }
                  transactionScope.Complete();
                  return null;
              }
  </code></pre>
  
  <p>The method calls queryAdmission that returns data from DB using linq to sql:</p>
  
  <pre><code>private static Func&lt;BMDataContext, long, PatientAdmission&gt; queryAdmission = System.Data.Linq.CompiledQuery.Compile(
                 (BMDataContext context, long Id) =&gt; context.PatientAdmissions.FirstOrDefault(w =&gt; w.Id == Id));
  </code></pre>
  
  <p>Does anybody can help me with this error - ".Net Framework Data Provider error 60." ?</p>