conn = pymssql.connect(host="192.168.122.141",
port=1433,
user="myshop",
password="oyf20140208HH",
database="mySHOPCMStock",
charset='utf8',#不用聲明字符集也可以
as_dict=True)
cur = conn.cursor()
sql = "select top 10 [ID],[Name] from [User]"
cur.execute(sql)
list = cur.fetchall()
for row in list:
print(row["ID"],row["Name"].encode('latin-1').decode('gbk'))