mardi 22 décembre 2015

Python SQLite 'Database locked'

Trying to insert values into my database but it returns 'Database locked', and I have connected to it.

Here is my code that I might useful for you all!

conn = sqlite3.connect("birthdays.db")
db = conn.cursor()

vieworadd = input("Would you like to view the database or add a new row? 'view' or 'add': ")
conn = sqlite3.connect("birthdays.db") #connects to db

db.execute("INSERT INTO birthdays VALUES('%s', '%s', '%s', '%s')" % (name, year, month, day))
conn.commit()
conn.close()

Everything is in a while loop, not sure if useful info.. Just putting it out there! :)

Aucun commentaire:

Enregistrer un commentaire