pyodbc连接sqlserver2008出现Previous SQL was not a query报错
pyodbc.ProgrammingError: No results. Previous SQL was not a query.
网上流传解决方法
sql语句中加一句SET NOCOUNT ON;
尝试过无效
row = cursor.execute(sql).fetchone()
一直报错
同事解决方法
row = cursor.execute(sql).fetchone()
更改为
row = cursor.execute(sql)
while cursor.nextset():
try:
row = cursor.fetchone()
break
except pyodbc.ProgrammingError:
continue