i have a python code that creates a gui where i make the query using a cursor (=curs) asking from the user to enter a serial number. According to this number the oracle table returns a result (ie 1111111). After that, I want a second query from another table: ‘select project_name from customer_desc where customer_name_d= the value in the customer box(=1111111)'. Any ideas? I need to make a new connection to the base? How can I set the where clause in order to read the textvalue returned to gui text field, with blind variables? Thanks
import cx_Oracle
from tkinter import*
from tkinter import messagebox
def search():
try:
connstr='SOLVATIO/SOLVATIO@localhost'
conn = cx_Oracle.connect(connstr)
curs = conn.cursor()
curs.execute("select * from customers where afm='%s'"%afm.get())
result=curs.fetchone()
company_name.set(result[1])
e1.configure(state='disabled')
conn.close()
def clear():
afm.set('')
company_name.set('')
e1.configure(state='normal')
a1=Tk()
a1.title('SOLVATIO')
a1.geometry('600x300')
ptitle=Label(a1, text='''search asset''')
ptitle.grid(row=0, column=0, columnspan=2)
afm=StringVar()
company_name=StringVar()
l1=Label (a1, text=' AFM ')
e1=Entry(a1, textvariable=afm)
l2=Label (a1, text=' customer ')
e2=Entry(a1, textvariable=company_name)
b1=Button(a1, text=' Search ', command=search)
l1.grid(row=1, column=0)
e1.grid(row=1, column=1)
l2.grid(row=2, column=0)
e2.grid(row=2, column=1)
b1.grid(row=1, column=2)
a1.mainloop()