[PyKDE] Using QSqlQuery + bindValue = TypeError ?

Jorge Godoy godoy at ieee.org
Sun Feb 27 13:37:06 GMT 2005


Hi!


I'm trying to use a QSqlQuery and then supply the values with bindValue but it
isn't working.

I read my values from a QLineEdit with

        senhaNova = self.txtNovaSenha.text()

and then I create the query

        query = QSqlQuery ()
        query.prepare("UPDATE usuarios SET senha=:senha")

after that I try binding the value

        query.bindValue(":senha", senhaNova)

and, finally, executing the query

        query.execQuery()


But I keep always getting the following error message:

    query.bindValue(":senha", senhaNova)
TypeError: argument 2 of QSqlQuery.bindValue() has an invalid type


Doing a "print type(senhaNova)" I get <class '__main__.qt.QString'> as the
result. 

What am I doing wrong?


Thanks in advance,
Godoy.




More information about the PyQt mailing list