python 链接MS SQL

cnxn = pyodbc.connect(driver='{SQL Server}', host=server, database=db1,
                      trusted_connection=tcon, user=uname, password=pword)
cursor = cnxn.cursor()
cursor.execute("select * from appaudit_q32013")
rows = cursor.fetchall()
for row in rows:
    print row

 

IMPORT PYODBC

 

posted @ 2015-10-06 18:26  西番莲果汁  阅读(202)  评论(0编辑  收藏  举报