用sqlsever2012建立的本地studengts数据库,info是数据表
源代码
import pyodbc
path='DRIVER={SQL Serve Native Client 11.0 };DATABASE=students;SERVER=Localhost;UID=sa;PWD=zhuyongcheng'
coxn = pyodbc.connect(path)
cursor = coxn.cursor()
cursor.execute("select * from info")
a1 = cursor.fetchall()
print(a1)
coxn.commit()
coxn.close()
以下是错误提示:
