AnsweredAssumed Answered

pyodbc reads fine, but won't update a value?...

Question asked by KevinBellSLC on Oct 31, 2014
Latest reply on Oct 31, 2014 by KevinBellSLC

Hi all!  HELP!   : )

 

I'm able to read rows from SQL Server just fine with pyodbc, but I can't seem to update a row.  Any ideas?  At this point there's no gis involvement here, but there will be once I can modify the table.

 

import pyodbc

 

cstring = 'DRIVER={SQL Server};SERVER=aServer;DATABASE=aDatabase;UID=aUN;PWD=aPassword'

con = pyodbc.connect(cstring)

cur = con.cursor()

 

sql = """UPDATE Stats SET myColumn = 'TEST' WHERE case_number = 'case9999'"""

 

rows = cur.execute(sql).fetchall()

 

con.commit()

cur.close()

del cur, con

 

>>>pyodbc.ProgrammingError: No results.  Previous SQL was not a query.

Outcomes