title: Problems with TransactionScope in ASP.NET
body: <p>I've build a class to synchronize data between two different datasources. This synchronization is divided into multiple parts (and methods). Every method has his own TransactionScope and the methods are run sequentially.</p>
  
  <p>Everytime I Run this code I get the following errormessage:</p>
  
  <p><strong>"The transaction associated with the current connection has completed but has not been disposed. The transaction must be disposed before the connection can be used to execute SQL statements."</strong></p>
  
  <p>The following code is an example of such a method with a TransactionScope:</p>
  
  <pre><code>private void SomeMethod()
  {
          try
          {
              using (var _transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionOptions))
              {
                  using (SqlConnection _connection = new SqlConnection(connectionstring))
                  {
                      _connection.Open();
  
                      DoSomething()...
                  }
  
                  _transactionScope.Complete();
              }
          }
          catch (TransactionAbortedException e)
          {
              nlog.Error(string.Format("The transaction has been aborted: {0}", e.Message));
              throw e;
          }
          catch (Exception e)
          {
              throw e;
          }
  }
  </code></pre>
  
  <p>It seems that the call <strong>"_transactionScope.Complete()"</strong> isn't enough to kill the transactionscope.. Does anyone have a clue what i'm doing wrong?</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>UPDATE</strong>
  Thanks for your replies. After a few tests I discovered that this problem only exists when there are multiple queries in one method. for example:</p>
  
  <pre><code> try
      {
          using (TransactionScope _transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionOptions))
          {
              using (SqlConnection _connection = new SqlConnection(connectionstring))
              {
                  _connection.Open();
  
                  //new method:
                  using (TransactionScope _transactionScope = new TransactionScope(TransactionScopeOption.Suppress))
                  {
                      //a selectquery
                  }
  
                  //an update or insert query
  
              _transactionScope.Complete();
          }
      }
  </code></pre>