Operational error in sql when inserting values into a table
up vote
0
down vote
favorite
My SQL is giving me errors when running
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()
with the error code:
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
python sqlite3
add a comment |
up vote
0
down vote
favorite
My SQL is giving me errors when running
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()
with the error code:
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
python sqlite3
2
You are using a wrong syntax for your INSERT. See w3schools.com/sql/sql_insert.asp to a correct example.
– Klaus D.
Nov 10 at 18:26
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
My SQL is giving me errors when running
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()
with the error code:
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
python sqlite3
My SQL is giving me errors when running
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()
with the error code:
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
python sqlite3
python sqlite3
asked Nov 10 at 18:24
James Green
407
407
2
You are using a wrong syntax for your INSERT. See w3schools.com/sql/sql_insert.asp to a correct example.
– Klaus D.
Nov 10 at 18:26
add a comment |
2
You are using a wrong syntax for your INSERT. See w3schools.com/sql/sql_insert.asp to a correct example.
– Klaus D.
Nov 10 at 18:26
2
2
You are using a wrong syntax for your INSERT. See w3schools.com/sql/sql_insert.asp to a correct example.
– Klaus D.
Nov 10 at 18:26
You are using a wrong syntax for your INSERT. See w3schools.com/sql/sql_insert.asp to a correct example.
– Klaus D.
Nov 10 at 18:26
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
draft saved
draft discarded
draft saved
draft discarded
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242082%2foperational-error-in-sql-when-inserting-values-into-a-table%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
You are using a wrong syntax for your INSERT. See w3schools.com/sql/sql_insert.asp to a correct example.
– Klaus D.
Nov 10 at 18:26