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


i want make login window , , there 2 qlineedits in window . must input correct account , password in login successful.
there 2 groups account , password in member.db
first : account:aaa , password:000
second : account:bbb , password:111

here part of code: howerver when select data of account , can't catch value .

 def buttonclicked(self):                 model = qsqlquerymodel()         a=model.setquery("select password member 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 error in a=model.setquery("select password member account = values(\'{0}')".format(self.accountedit)) code. because tried print(a) , return none .

this not valid sql; should use where account = 'name'.

furthermore, prevent sql injection attacks, should use parameters; possible using separate qsqlquery object:

query = qsqlquery() query.prepare("select password member account = ?") query.bindvalue(0, self.accountedit) query.exec_() model = qsqlquerymodel() model.setquery(query) 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -