title: SQL error timeout with transaction
body: <p>I have an ASP.NET application importing data from a CSV file, and storing it to a (SQL Server) database table. Basically, the import process consists of:</p>
  
  <ul>
  <li>Importing the raw CSV data into a corresponding SQL table (with the same columns)</li>
  <li>"Merging" the data into the DB, with some sql clauses (INSERTS and UPDATE)</li>
  </ul>
  
  <p>The whole import procedure is wrapped with a transaction.</p>
  
  <pre><code>using (SqlConnection c = new SqlConnection(cSqlHelper.GetConnectionString()))
  {
      c.Open();
  
      SqlTransaction trans = c.BeginTransaction();
  
      SqlCommand cmd = new SqlCommand("DELETE FROM T_TempCsvImport", c, trans);
      cmd.ExecuteNonQuery();
  
      // Other import SQL ...
  
      trans.Commit();
  }
  </code></pre>
  
  <p>Trying this import procedure from a virtual machine (everything is local), I got an error</p>
  
  <pre><code>[SqlException (0x80131904): Timeout. The timeout period elapsed prior to completion of the operation or the server is not responding.
  </code></pre>
  
  <p>Trying the same <strong>without</strong> the transaction, works fine.</p>
  
  <p>Something I tried:</p>
  
  <ul>
  <li>Executing the same queries from SQL Server Management Studio, all of them runs quite fast (500ms)</li>
  <li>Executing from my development machine, works fine</li>
  <li>Increasing the Command Timeout, I get the error anyhow. I also tried to set CommandTimeout to 0 (infinite), and the procedure seems to run "forever" (I get a server timeout, which I set to 10 minutes)</li>
  </ul>
  
  <p>So, the final question is: why the SQL transaction is creating such problems? Why is it working without the transaction?</p>