我不确定为什么这不起作用。当我尝试运行循环的任何部分时,我得到 sqlite3.OperationalError: near "WHERE": 语法错误。
con = sqlite3.connect('DatabaseName.sql')
cur = con.cursor()
if changes == "1":
Fname = input("Enter new first name: ")
Lname = input("Enter the last name of the person whom first name you wish to change: ")
cur.execute("""UPDATE Contacts SET Fname WHERE Lname""")
con.commit()
elif changes == "2":
Lname = input("Enter new last name: ")
Fname = input("Enter the first name of the person whom last name you wish to change: ")
cur.execute("UPDATE Contacts SET Lname WHERE Fname")
con.commit()
elif changes == "3":
Phone = input("Enter new telephone number(no dashes or spaces): ")
Fname = input("Enter the first name of the person whom telephone number you wish to change: ")
Lname = input("Enter the last name of the person whom telephone number you wish to change: ")
Phone = int(Phone)
cur.execute("""UPDATE Contacts SET Phone WHERE Fname AND Lname""")
con.commit()