将值插入表中时SQL中的操作错误

时间:2018-11-10 18:24:26

标签: python sqlite

我的SQL在运行时给我错误

import sqlite3

conn = sqlite3.connect("test.db")

cursor1 = conn.cursor()

cursor1.execute("CREATE TABLE IF NOT EXISTS TEST2 (a int, b text, c dates)")
conn.commit()
cursor1.execute("""INSERT INTO TEST2 VALUES (b='Hello World', c= ?""",(1,))
conn.commit()

,错误代码:

  Traceback (most recent call last):
  File "C:/Users/Green/Desktop/Py Proj/DataBase test.py", line 9, in <module>
    cursor1.execute("""INSERT INTO TEST2 VALUES (b='Hello World', c= ?""",(1,))
sqlite3.OperationalError: near "?": syntax error

0 个答案:

没有答案