Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Deleting a row in SQlite3
#1
I am creating a function to delete a row in SQlite3. It works, but the program just update what I've deleted when I close and run it again. There is anyway that I can do it without closing and opening again?
    def exclude (self, *args, **kwargs):
        result = tkinter.messagebox.askyesno('Provedor', 'Deseja realmente deletar?', icon = 'warning')
        if result == True:
            deletar = "DELETE FROM inventory WHERE Name = ?"
            c.execute(deletar,(self.Name_e.get(),))
            conn.commit()
Reply
#2
(Jul-22-2020, 02:31 PM)SmukasPlays Wrote: It works, but the program just update what I've deleted when I close and run it again
What do you mean? Does the row get deleted or not? One thing that is not correct is the following:
conn.comit()
It should be:
conn.commit()
(Unless of course comit() is a function or method you added yourself.)
Reply
#3
(Jul-22-2020, 05:46 PM)ibreeden Wrote:
(Jul-22-2020, 02:31 PM)SmukasPlays Wrote: It works, but the program just update what I've deleted when I close and run it again
What do you mean? Does the row get deleted or not? One thing that is not correct is the following:
conn.comit()
It should be:
conn.commit()
(Unless of course comit() is a function or method you added yourself.)

Oh, I didn't noticied it, thanks. I wrote commit() now but it still doesn't work. I mean that, the row is just deleted when I close the program and open it again. If i search for the row that I've deleted before closing, it will appear again.
Reply
#4
You need to post a minimal, complete program that demonstrates the problem. Not seeing the other code means we can't help diagnose the problem.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Deleting data in SQlite3 SmukasPlays 0 1,455 Jul-25-2020, 02:07 PM
Last Post: SmukasPlays
  Deleting data in sqlite3 JJ39 3 2,489 Jun-23-2019, 04:39 PM
Last Post: noisefloor

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020