sqlite3.OperationalError:“VALUES”附近:语法错误

时间:2018-05-26 18:46:34

标签: python sqlite

username = input("Username: ")
password = input("Password: ")
authority = input("Authority level (1 or 2): ")
name = input("Name           : ")
surname = input("Surname        : ")
idnum = input("Identity Number: ")
c.execute("CREATE TABLE IF NOT EXISTS userInfo(username TEXT, password TEXT, authority TEXT, name TEXT, "
          "surname TEXT, idnum TEXT)")
c.execute("INSERT INTO userInfo VALUES(username, password, authority, name, surname, idnum) "
          "VALUES(?, ?, ?, ?, ?, ?)",
          (username, password, authority, name, surname, idnum))

conn.commit()

似乎没有错,但它会返回:

  

sqlite3.OperationalError:靠近“VALUES”:语法错误

和users.db仍为空

1 个答案:

答案 0 :(得分:0)

nope ..我明白了..

c.execute("INSERT INTO userInfo (username, password, authority, name, surname, idnum) "

VALUES正在犯这个错误..

当我在这里发布我的问题时,我讨厌这个(我在这里发帖后至少考虑了一小时)我立刻找到答案......