import pymssql
conn = pymssql.connect(host="10.0.0.115",user="sa",password="sa",database="test",charset="utf8")
cur = conn.cursor()
if not cur:
raise (NameError,"数据库连接失败")
cur.execute("SELECT * from student")
resList = cur.fetchall()#fetchall()是接收全部的返回结果行
conn.close()
print(resList)