1

How to take two values into sqlite3 ?

v1 = '2011.11.10'
v2 = 10

vv1=(v1,)
vv2=(v2,)


conn = sqlite3.connect('date.db')
c = conn.cursor()
c.execute(" UPDATE archive SET date=? WHERE Id=? ", (vv1,vv2) ) # (vv1,vv2) this is not work, how?
conn.commit()

I know, that probably a simple , but can't find anything on net. Tnx

1 Answer 1

1
v1 = '2011.11.10'
v2 = 10
...
c.execute(" UPDATE archive SET date=? WHERE Id=? ", (v1,v2) ) 

For cursor.execute, pass a sequence of values, not a sequence of sequence of values.

For cursor.executemany, in contrast, you would want to pass a sequence of sequences.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.