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
#7
I modify the line 11 of the code of the function (select_by_dates ):

def select_by_dates (self):
               
    start_date =self.lineEdit_start_date.text()             
    end_date = self.lineEdit_end_date.text()
             
    try :
         
        conn = sqlite3.connect ('correction.db')
        curseur=conn.cursor()
      
		curseur.execute('SELECT * FROM correction_loc35R  where  date_correction between ? AND ? ORDER BY date_correction DESC', (start_date, end_date))
                     
         
        liste_select_by_dates_correction=c.fetchall()
        nbr_rows=len(liste_select_by_dates_correction)
                   
        if nbr_rows != 0 :
             
            # set row count
            self.tableWidget_select_by_dates_correction.setRowCount(nbr_rows)
                     
            for nb in range(nbr_rows):
                for nombre in range(10):
                self.tableWidget_select_by_dates_correction.setItem(nb,nombre, QTableWidgetItem(liste_select_by_dates_correction[nb][nombre]))
                 
            self.tableWidget_select_by_dates_correction.resizeRowsToContents()
            self.tableWidget_select_by_dates_correction.resizeColumnsToContents()        
                         
        conn.commit()
        curseur.close()
        conn.close()
        else :
            print("OK")
 
        except :
            print("error")
but always the same probleme like there is no data in database
Reply


Messages In This Thread
RE: to display cotent of database between two dates - by atlass218 - Dec-27-2019, 01:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Display and update the label text which display the serial value jenkins43 5 9,068 Feb-04-2019, 04:36 AM
Last Post: Larz60+
  Display more than one button in GUI to display MPU6000 Sensor readings barry76 4 3,884 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