title: "Invalid cursor state" error when executing a batch that includes a USE statement
body: <p>I tried retrieving data from a Microsoft SQL database using pypyodbc 1.3.3 with Python 3.5 on Windows but got a pypyodbc.ProgrammingError '[24000] [Microsoft] [SQL Server Native Client 11.0] Invalid cursor state' using the following code:</p>
  
  <pre><code>import pypyodbc
  conn = pypyodbc.connect(r'DRIVER={SQL Server Native Client 11.0};SERVER=server;DATABASE=database;UID=uid;PWD=pwd')
  cursor = conn.cursor()
  sql = '''USE database;
  SELECT R0
  FROM table;'''
  cursor.execute(sql)
  results = cursor.fetchone()
  print(results)
  </code></pre>
  
  <p>The SQL works in Microsoft SQL Server Management Studio, the connection and executing worked in another script i wrote to insert into the same database and also works if i remove</p>
  
  <pre><code>results = cursor.fetchone()
  </code></pre>
  
  <p>So far I tried cursor.fetchone(), cursor.fetchall() and list(cursor) but all produced the same result which leads me to believe that the command itself isn't the problem.
  According to <a href="https://msdn.microsoft.com/de-de/library/ms709301(v=vs.85).aspx" rel="nofollow">this microsoft site</a> it means that there isn't an open cursor, but I can get it's description, so from my understanding there has to be.</p>