我无法从数据库中删除值?

时间:2019-05-06 14:51:00

标签: python mysql python-3.x

我无法从数据库中删除值,我的数据库有4列学生姓名,学生证号,学生手机号码和父亲的姓名。我想通过输入学生的身份证号来删除学生的记录。

def deleting (self):
    db = MySQLdb.connect(host="**",    # your host, usually localhost
                 user="**",         # your username
                 passwd="***",  
                 db="idk")        # name of the data base
    cursor = db.cursor()
    student_ID=self.student_ID.get()
    print(student_ID)
    cursor.execute("DELETE FROM Student_details WHERE student_ID=%s",(student_ID,))
    db.commit()
    db.close()
    self.message['text'] = 'Record {} deleted'.format(student_ID)

正在打印学生证,表明它正在接收价值,但无法删除记录。

0 个答案:

没有答案