当前位置: 首页 > 工具软件 > pymssql > 使用案例 >

引入pymssql模块

公良照
2023-12-01

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()

 类似资料: