Error: "sqlite3.OperationalError: no such table"

1

I have the following error:

  

sqlite3.OperationalError: no such table: product

I already checked in my database, the product table is there

Code:

from tkinter import *
from tkinter import ttk
import sqlite3

root = Tk()
root.geometry('600x500+340+50')
root.title('Cadastro')
root.resizable(False,False)
root.configure(bg='azure')

banco = 'Database.db'

frame = LabelFrame(root, text='Adicionar Novo',bg='azure')
frame.grid(padx=200,pady=30)
lb = Label(frame,text='Nome:',width=15,bg='azure')
lb.grid(row=1,column=0)
lb2 = Label(frame, text='Preço:',bg='azure')
lb2.grid(row=2,column=0)

i = Button(frame,text='Adicionar',bg='azure')
i.grid(row=4,column=1,pady=4)
o = Label(frame)
o.grid(row=0,column=0)


name = Entry(frame)
name.grid(row=1,column=1,padx=5)

price = Entry(frame)
price.grid(row=2,column=1,padx=5)

tree = ttk.Treeview(height=12,column=2)
tree.grid(row=1,column=0,columnspan=2)
tree.heading('#0', text='Nome',anchor=CENTER)
tree.heading('#1', text='Preço',anchor=CENTER)

bt_ed = Button(text='Editar',bg='azure')
bt_ed.place(x=330,y=450)
bt_del = Button(text='Deletar',bg='azure')
bt_del.place(x=270,y=450)

parameters = ()
query = 'SELECT* FROM produto ORDER BY name DESC'
conn = sqlite3.connect(banco)
cur = conn.cursor()
query_result = cur.execute(query)
conn.commit()

records = tree.get_children()

for element in records:
    tree.delete(element)

db_rows = run_query(query)

for row in db_rows:
    tree.insert('',0,text=row[1],value=row[2])



root.mainloop()
    
asked by anonymous 09.08.2018 / 02:38

0 answers