mardi 7 juillet 2015

How to select the value to check the account and password?

I want to make a login window , and there are two QlineEdits in this window . We must input the correct account and password in it then login successful.
There are two groups account and password in member.db
First : Account:aaa , Password:000
Second : Account:bbb , Password:111

Here is part of my code: Howerver when I select the data of account , it can't catch the value .

 def buttonClicked(self):        
        model = QSqlQueryModel()
        a=model.setQuery("SELECT Password FROM member WHERE Account = values(\'{0}')".format(self.AccountEdit))
        if a==self.PasswordEdit.text():
            QtGui.QMessageBox.information(self, 'message',"Congratulations !!!")
        else:
            QtGui.QMessageBox.warning(self, 'message',"Error !!!")

I think the error is in a=model.setQuery("SELECT Password FROM member WHERE Account = values(\'{0}')".format(self.AccountEdit)) this code. Because I tried to print(a) and it return None .

Aucun commentaire:

Enregistrer un commentaire