title: Multiple connections to the same DB in the same TransactionScope
body: <p>How are the connections handled in a single transaction when we open close connections for each statement in C#?</p>
  
  <p>The scenario is with the <strong>same connection string</strong> and the connection is opened and closed multiple types, once for every statement.</p>
  
  <p>Consider the following example</p>
  
  <pre><code>void updateSomething() {
      using (SqlConnection connection = new SqlConnection(  
        "Integrated Security=SSPI;Initial Catalog=Northwind"))  
      {  
          connection.Open();        
          // Execute the statements
          connection.Close();  
      }  
   }
  </code></pre>
  
  <p>When I'm executing the following code:</p>
  
  <pre><code>void SomeMethod()
  {
      using(TransactionScope scope = new TransactionScope())
      {
          for(int i=0; i &lt; 10; i++) 
          {
              this.updateSomething();
          }
          scope.Complete();
      }
  }
  </code></pre>
  
  <p>The recommendation is to use a connection Open/Close for each statement. That is because we are not actually creating connections, we are just using one from the pool.</p>
  
  <p>Why is this the case? I get it that we hold the connection for as little time as we can, but the thing is that in most transactions, we are going to get it in the next moment during the next statement.</p>
  
  <p>Is it only to avoid the demanding code computation time in between the statements if some such exists (which it shouldn't as it would lock the database in the transaction state for much longer that needed).</p>
  
  <p>Wouldn't it make sense to keep one connection open for the duration of the transaction?</p>