Python Forum
Selection and display of data by combobox
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selection and display of data by combobox
#2
(Feb-02-2020, 07:15 AM)LagratteCchouette Wrote: The search must be strictly equal to the name of the author selected in my combobox "cmb_author".

Thanks for your help.
Should we use LIKE?
If the name must be strictly equal you must not use the keyword "LIKE".

Furtheron you seem to have problems with the SQL statement. Now I do not know Sqlite3, but I do know SQL. So I believe your query should be:
curseur.execute("SELECT * FROM tb_quote WHERE author_author LIKE '%" + data1 + "%\'")
But as we just agreed you should not use "LIKE" it would have to be:
curseur.execute("SELECT * FROM tb_quote WHERE author_author = '" + data1 + "'")
... Or even more pythonic use an f-string:
curseur.execute(f"SELECT * FROM tb_quote WHERE author_author = '{data1}'")
Reply


Messages In This Thread
RE: Selection and display of data by combobox - by ibreeden - Feb-02-2020, 09:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to display <IPython.core.display.HTML object>? pythopen 3 46,171 May-06-2023, 08:14 AM
Last Post: pramod08728
  Store variable data and display sum after 60 seconds the_dude 11 3,531 Dec-16-2021, 07:07 PM
Last Post: deanhystad
  How to display combobox related values in labels Lalremruata 0 1,589 Jul-20-2021, 02:45 AM
Last Post: Lalremruata
Information Unable to display joystick's value from Python onto display box MelfoyGray 2 2,282 Nov-11-2020, 02:23 AM
Last Post: MelfoyGray
  Binding Complex data to Combobox gcfernando 2 2,118 Sep-14-2020, 03:24 PM
Last Post: gcfernando
  def Display Data Invalid Syntax error Linuxdesire 1 1,910 Oct-11-2019, 05:10 AM
Last Post: stranac
  Need help to display data from a file Dzib 2 3,404 Sep-26-2019, 04:12 AM
Last Post: Dzib
  Reading data into a Combobox from a .CSV file KevinBrown 7 8,641 Apr-14-2019, 11:30 AM
Last Post: KevinBrown
  Display 20 records at a time,data structure or loop pythonds 1 2,500 Mar-29-2018, 11:09 AM
Last Post: DeaD_EyE
  QSqlRelationalTableModel: how do I save combobox data? panoss 2 6,390 Feb-08-2017, 08:13 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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