Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SQlite question
#1
When I run this piece of code, I get a syntax error. Could someone please pinpoint the error.


conn = sqlite3.connect('roominventory.db')
                c = conn.cursor()
                c.fetchall()
                c.execute("""UPDATE rooms SET rate = nq1.get() WHERE type = 'NQ1'
                            """)

                conn.commit()
                conn.close()
Reply
#2
c.fetchall() should be below the c.execute()
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags


Reply
#3
(Apr-30-2020, 09:18 PM)scratchmyhead Wrote: Could someone please pinpoint the error.
post the full traceback you get, in error tags.
You run UPDATE statement, so c.fetchall() is not needed at all.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Forum Jump:

User Panel Messages

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