Mar-28-2019, 11:08 PM
Hi Guys,
As per my previous post, I am new to Python (Gui) and in the process of learning.
I am having a particular issue with a search query against SQLite Db.
What am I trying to achieve?
I have defined three search entries where I am trying to query a table and 2 columns. or Better yet, I would like to query the entire table 'assets2' but when I select * from
I have tried the following
AND statement:
As per my previous post, I am new to Python (Gui) and in the process of learning.
I am having a particular issue with a search query against SQLite Db.
What am I trying to achieve?
I have defined three search entries where I am trying to query a table and 2 columns. or Better yet, I would like to query the entire table 'assets2' but when I select * from
assets2
it comes up with an argument error.I have tried the following
AND statement:
cursor.execute("SELECT * FROM `assets2` WHERE `Asset_Serial` AND `Asset_Model` LIKE ?", ('%'+str(SEARCH2.get())+'%',))OR statement:
cursor.execute("SELECT * FROM `assets2` WHERE `Asset_Serial` or `Asset_Model` LIKE ?", ('%'+str(SEARCH2.get())+'%',))Below is the search2 snippet.
def Search2(): if SEARCH2.get() != "": tree.delete(*tree.get_children()) Database() cursor.execute("SELECT * FROM `assets2` WHERE `Asset_Serial` LIKE ?", ('%'+str(SEARCH2.get())+'%',)) fetch = cursor.fetchall() for data in fetch: tree.insert('', 'end', values=(data)) cursor.close() conn.close()Thanks Whacky7