Inserting image and date into sqlite3 database
Unsolved
General and Desktop
-
wrote on 14 Oct 2021, 15:21 last edited by
Hi, I'm trying to insert the following into my sqlite3 database but it does not work. Please below is my code, I need assistance please. Thanks in advance.
def ADD__NEW_DETAILS(self): name = self.ui.lineEdit_38.text() telephone = self.ui.lineEdit_32.text() email = self.ui.lineEdit_25.text() dob = self.ui.dateEdit.date() image = self.ui.Display_label.text() if ( name and telephone and email and image !=""): try: cur.execute(("INSERT INTO personal_details (name, telephone_no, email,birth_date, photo) VALUES(?,?,?,?,?)"), (name, telephone ,email ,dob ,image,)) con.commit() QMessageBox.information(self, "Success", "Details Has Been Added") name = self.ui.lineEdit_38.clear() telephone = self.ui.lineEdit_32.clear() email = self.ui.lineEdit_25.clear() dob = self.ui.dateEdit.clear() image = self.ui.Display_label.clear() except: QMessageBox.information(self, "Warning", "Details Has Not Been Added") else: QMessageBox.information(self, "Warning", "All Fields Are Required Cannot Be Empty") name = self.ui.lineEdit_38.clear() telephone = self.ui.lineEdit_32.clear() email = self.ui.lineEdit_25.clear() dob = self.ui.dateEdit.clear() image = self.ui.Display_label.clear()
-
Hi, I'm trying to insert the following into my sqlite3 database but it does not work. Please below is my code, I need assistance please. Thanks in advance.
def ADD__NEW_DETAILS(self): name = self.ui.lineEdit_38.text() telephone = self.ui.lineEdit_32.text() email = self.ui.lineEdit_25.text() dob = self.ui.dateEdit.date() image = self.ui.Display_label.text() if ( name and telephone and email and image !=""): try: cur.execute(("INSERT INTO personal_details (name, telephone_no, email,birth_date, photo) VALUES(?,?,?,?,?)"), (name, telephone ,email ,dob ,image,)) con.commit() QMessageBox.information(self, "Success", "Details Has Been Added") name = self.ui.lineEdit_38.clear() telephone = self.ui.lineEdit_32.clear() email = self.ui.lineEdit_25.clear() dob = self.ui.dateEdit.clear() image = self.ui.Display_label.clear() except: QMessageBox.information(self, "Warning", "Details Has Not Been Added") else: QMessageBox.information(self, "Warning", "All Fields Are Required Cannot Be Empty") name = self.ui.lineEdit_38.clear() telephone = self.ui.lineEdit_32.clear() email = self.ui.lineEdit_25.clear() dob = self.ui.dateEdit.clear() image = self.ui.Display_label.clear()
-
wrote on 14 Oct 2021, 18:19 last edited by
YMMV inserting images into a database. BLOB field support is often a special case, if supported by the DB at all.
1/3