title: .net SqlCommandTimeOut and the connection pool
body: <p>Let's say we are executing lots of different sql command, and the <code>SqlCommand.CommandTimeout</code> was leave with default value 30 seconds. </p>
  
  <p>And let's just assume some of those sql command are just long query and we might get the timeout exception. </p>
  
  <p>Correct me if I'm wrong, this exception was just cause .Net do not want to wait anymore, but if we are using connection pool, this connection might be remain open, so will that sql statement might still running on the SQL server side? Or there are some hidden communication between those system to suddenly stop it no matter we are using connection pool or not? </p>
  
  <p>Just want to know what's the mechanism and would it effect the SQL server performance. I mean if the query is really long such as take 10 mins to run if it's still running it might just slow down the server unnecessary as no one can get the result.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>So here I'm asking about the connection pool specifically, it's definitely that the code will close the connection with exception handling, or we can just assume that are using code which is a pattern preferred named by @dash here. The problem is if I call the Close() or Dispose() method on that SqlConnection object, it is returned to the connection pool, it's not physically close it.</p>
  
  <p>I'm asking when it's returned to pool, would that long query still running on SQL Server side. And if possible, how to avoid that.</p>
  
  <p><strong>UPDATE again</strong></p>
  
  <p>Thanks for @dash mentioning that about database transaction, yes a rollback will make it wait and we are not closing the connection and return it to the pool yet. So what if it's just a long select query or an update but just one individual update without any database transaction involved? And specifically I want to know is there a way that we can tell SQL Server that I do not need the result now please stop running it?</p>