title: Can I use multiple cursors on one connection with pyodbc and MS SQL Server?
body: <p>I'm using pyodbc on python 2.6 to connect to Microsoft SQL Server 2005. I open a connection, create a couple of cursors:</p>
  
  <pre><code>c1 = connection.cursor()
  c2 = connection.cursor()
  </code></pre>
  
  <p>and then run a query on the first cursor.</p>
  
  <pre><code>c1.execute("select * from foo")
  </code></pre>
  
  <p>Now I run a query on the second cursor:</p>
  
  <pre><code>c2.execute("select * from bar")
  </code></pre>
  
  <p>...and I get an error: "Connection is busy with results for another hstmt."</p>
  
  <p>After I do a <code>c1.fetchall()</code> or <code>c1.close()</code> then I can use c2.</p>
  
  <p>My question is: Why am I even allowed to create multiple cursors on a connection, if I'm only allowed to use one at a time, and the same one can always be reused? And, if I want to run a query for each row of the results of another query, like this:</p>
  
  <pre><code>for x in c1.execute(...):
      for y in c2.execute(...):
  </code></pre>
  
  <p>do I really have to create multiple connections to the same database?</p>