SoftTesting/案例5.py
2025-04-14 23:37:02 +08:00

15 lines
280 B
Python

import pymysql
db=pymysql.connect (
host='localhost',
user='root',
passwd='114514',
database='TESTDB',
)
cursor=db.cursor()
sql="UPDATE EMPLOYEE SET AGE=AGE+1 WHERE SEX = '%c'" % 'M'
try:
cursor.execute(sql)
db.commit()
except:
db.rollback()
db.close()