how to get user input from qdateEdit and select it from database in postgres
问题 i want to know how to get the user input in QDateEdit and select it in a table in postgres? here is my code def date(self): try: date = self.dateEdit.date() print(date) conn = psycopg2.connect(dbname="sample", user="postgres", password="admin", host="localhost", port="5432") cur = conn.cursor() cur.execute("SELECT * FROM data WHERE stdate = '%s'",date) result = cur.fetchall() self.tableWidget.setRowCount(0) for row_number, row_data in enumerate(result): self.tableWidget.insertRow(row_number)