title: Stored Procedure - Invalid cursor state
body: <p>I am trying to run a stored procedure and im getting the error below. I tried doing AutoCommit = True but still no luck.</p>
  <p>error:</p>
  <pre><code>pypyodbc.ProgrammingError: ('24000', '[24000] [Microsoft][ODBC SQL Server Driver]Invalid cursor state')
  </code></pre>
  <p>code</p>
  <pre><code> def sqlConnection():
  conn = pypyodbc.connect('Driver={SQL Server};''Server=test;''Database=test;'
                          'Trusted_Connection=yes;autocommit=True')
  
  cursor = conn.cursor()
  
  
  return conn, cursor
  
  def payments(cursor, conn):
      cd = datetime.today()
      formatted_date = datetime.strftime(cd, &quot;%m/%d/%Y&quot;)
  
       payments_q = &quot;&quot;&quot;\
          EXEC pRptMonTrTypeSumm @jobkey=?, @cdate=?
          &quot;&quot;&quot;
        params = (1, '08/30/2020')
        fpl_payments_results = cursor.execute(payments_q, params)
  
         for row in payments_results.fetchall():
         payments3 = row[4]
         print(payments3)
  </code></pre>