用pymssql插入数据时,始终不成功,最后查到资料,语句后加个commit才可以,如此牛逼的规则,记录一下
# 添加数据库数据 conn = pymssql.connect('xx', 'xx', 'xx', 'xx') if conn: print('connection successful') cursor = conn.cursor() sql = ("INSERT INTO yyy values('%s','%s','%s','%s','%s','%s','%s');commit" % (FG_PN, HA_FIX_NA, L_FIX_NA, SA_PN, SA_LO, HA_FIX_LO, L_FIX_LO)) cursor.execute(sql)