python学习--python 连接SQLServer数据库(两种方法)
1. python 学习、安装教程参照:
2. 集成开发环境 JetBrains PyCharm Community Edition 2018.3.4 x64
3. python 连接SQLServer数据库(两种方法)
# -*- coding:utf-8 -*- #方法一 import pymssql # server = "192.168.1.76" # 连接服务器地址 # user = "sa" # 连接帐号 # password = "sa" # 连接密码 # # with pymssql.connect(server, user, password, "Contract_Dev",charset="utf8") as conn: # with conn.cursor(as_dict=True) as cursor: # 数据存放到字典中 # cursor.execute(SELECT * FROM contract_Statelog WHERE Id=%d,2) # for row in cursor: # print("Id=%d, contract_StateName=%s" % (row[Id], row[contract_StateName])) #方法二1. python 学习、安装教程参照: 2. 集成开发环境 JetBrains PyCharm Community Edition 2018.3.4 x64 3. python 连接SQLServer数据库(两种方法) # -*- coding:utf-8 -*- #方法一 import pymssql # server = "192.168.1.76" # 连接服务器地址 # user = "sa" # 连接帐号 # password = "sa" # 连接密码 # # with pymssql.connect(server, user, password, "Contract_Dev",charset="utf8") as conn: # with conn.cursor(as_dict=True) as cursor: # 数据存放到字典中 # cursor.execute(SELECT * FROM contract_Statelog WHERE Id=%d,2) # for row in cursor: # print("Id=%d, contract_StateName=%s" % (row[Id], row[contract_StateName])) #方法二
下一篇:
在浏览器中输入URL后都会发生什么