Python 3 + tkinter and sqlite3
I'm doing a mock application to save a piece of text in sqlite
here's the function:
def saveNote(self,note_id):
conn = db.connect(fname)
c = conn.cursor()
safeTitle=self.newNoteTitle.get()
safeContents=self.newNoteText.get("1.0",tk.END)
safeLink=self.newNoteLink.get()
safeRemarks=self.newNoteRemarks.get()
conn.execute('UPDATE notes SET (title,contents,remarks,link,created,last_modified,notebook_id) VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, ?) WHERE notes_id=5', (safeTitle, safeContents, safeRemarks, safeLink, 1))
conn.commit()
self.master.destroy()
When executing the function, I get this error:
conn.execute('UPDATE notes SET (title,contents,remarks,link,created,last_modified,notebook_id) VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, ?) WHERE notes_id=5', (safeTitle, safeContents, safeRemarks, safeLink, 1))
sqlite3.OperationalError: near "(": syntax error
I don't quite understand why the syntax is wrong...(I'm new to python)...can anyone help me spot the mistake?
Thanks
Aucun commentaire:
Enregistrer un commentaire