import pymssql #引入pymssql模块
conn = pymssql.connect(host='My-202112291305',server='SQLEXPRESS',port='54700',user='sa',password='1',database='test',charset='utf8',autocommit=True)
print(conn)
cur = conn.cursor()
sql = "insert into [S2_MAP_Valve] values ('python','python','python','python','python','python');COMMIT "
try:
cur.execute(sql)
except:
conn.rollback()
cur.close()
conn.close()