提交 9ac70b9e 创建 作者: 王晓庆's avatar 王晓庆

更新 testsql.py

上级 9bd97a09
流水线 #118579 已通过 于阶段
用时 27 秒
...@@ -59,7 +59,7 @@ def get_conn(): ...@@ -59,7 +59,7 @@ def get_conn():
# 根据平台不同采用不同的连接方式 # 根据平台不同采用不同的连接方式
if sys.platform == 'linux': if sys.platform == 'linux':
# linux操作系统,用户名密码登录 # linux操作系统,用户名密码登录
conn = pymssql.connect(host='localhost', user='SA', password='<MyStrong@Passw0rd>') conn = pymssql.connect(host='localhost', user='SA', password='<MyStrong@Passw0rd>', charset = 'utf8')
else: else:
# windows操作系统,连接端口号 # windows操作系统,连接端口号
conn = pymssql.connect(host='localhost', server='localhost\SQLEXPRESS', port='1433', database='master') conn = pymssql.connect(host='localhost', server='localhost\SQLEXPRESS', port='1433', database='master')
...@@ -91,8 +91,8 @@ def my_msg_handler(msgstate, severity, srvname, procname, line, msgtext): ...@@ -91,8 +91,8 @@ def my_msg_handler(msgstate, severity, srvname, procname, line, msgtext):
the pieces of information sent by the server. the pieces of information sent by the server.
""" """
# print(yellow("%s" % msgtext)) # print(yellow("%s" % msgtext))
# print(yellow("%s" % msgtext.decode('utf-8'))) print(yellow("%s" % msgtext.decode('utf-8')))
print(yellow("%s" % msgtext.encode('utf-8'))) # print(yellow("%s" % msgtext.encode('utf-8')))
# 主函数 # 主函数
if __name__ == '__main__': if __name__ == '__main__':
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论