MySQLdb插入后获得插入id
时间:2014-05-12 13:02:44
收藏:0
阅读:394
print"ID of last record is ", int(cursor.lastrowid) #最后插入行的主键ID
print"ID of inserted record is ", int(conn.insert_id()) #最新插入行的主键ID,conn.insert_id()一定要在conn.commit()之前,否则会返回0
评论(0)