Python Forum
[PyQt] to display cotent of database between two dates
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] to display cotent of database between two dates
#20
Well it seems that some of your indentation is off but I think that I can adjust for that. Further assuming all that other disconnected stuff (first 3 functions/methods is working correctly. Here is all I think you need to adjust to make it work -- which is what I have been trying to get you to understand all along. Basically what you were doing was not passing in the variables' contents but a string of the variable name
        conn = sqlite3.connect ('correction.db')
        curseur=conn.cursor()
        strSQL = ''
        strSQL += "SELECT * "
        strSQL += "FROM correction_loc35R "
        strSQL += "WHERE date_correction "
        strSQL += "BETWEEN " + start_date.strftime('%Y-%m-%d')
        strSQL += "AND " + end_date.strftime('%Y-%m-%d')
        c=curseur.execute(strSQL)
Lastly let me state that you ought to have put your database interactions within a self-contained and autonomous Class where you simple call the API methods instead of what it appears you have perhaps done. What you have appears far more complex than it needs to be. Keep in mind if you keep it simple and smart it is far much easier to deal with now and later on.
Reply


Messages In This Thread
RE: to display cotent of database between two dates - by Denni - Jan-09-2020, 07:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Display and update the label text which display the serial value jenkins43 5 9,087 Feb-04-2019, 04:36 AM
Last Post: Larz60+
  Display more than one button in GUI to display MPU6000 Sensor readings barry76 4 3,894 Jan-05-2019, 01:48 PM
Last Post: wuf

Forum Jump:

User Panel Messages

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