python 3.x - PYQT5 QSqlQuery Error -
def seleccionar(self): self.db =qsqldatabase.adddatabase(self.db_type) self.db.sethostname(self.db_ip) self.db.setdatabasename(self.db_name) self.db.setusername(self.db_usname) self.db.setpassword(self.db_password ) estado=self.db.open() if estado==false: qmessagebox.warning(self,"error",self.db.lasterror().text(),qmessagebox.discard) else: try: self.table.setcolumncount(4) self.table.sethorizontalheaderlabels(["pid","server_ip","server_id","server_pwd"]) row=0 sql="select * stt_server" query=qsqlquery(sql) #error while query.next(): self.table.insertrow(row) pid=qtablewidgetitem(str(query.value(0))) server_ip=qtablewidgetitem(str(query.value(1))) server_id=qtablewidgetitem(str(query.value(2))) server_pwd=qtablewidgetitem(str(query.value(3))) self.table.setitem(row,0,pid) self.table.setitem(row, 1, server_ip) self.table.setitem(row, 2, server_id) self.table.setitem(row, 3, server_pwd) row=row+1 self.db.close() except: qmessagebox.warning(self, "error", self.db.lasterror().text(), qmessagebox.discard)
i updated python 3.4, changed python 3.5, updated pyqt 5.4 5.6, , got error.
an error occurs in query part. errer message "python has stopped working."
wiki
Comments
Post a Comment