15 lines
283 B
Python
15 lines
283 B
Python
import pymysql
|
|
db=pymysql.connect (
|
|
host='172.16.1.166',
|
|
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() |