[PyQt] sql problems of a n00b

ionut cristian cucu cuciferus at gmail.com
Tue Sep 1 22:24:15 BST 2009


Hi list!
I have the following query:
try:
            a=int(self.cautat.text())
            self.query.prepare('select * from pacienti where cnp = ?')
            print self.query.executedQuery()
            self.query.addBindValue(QtCore.QVariant(a))
            print a
        except ValueError:
            self.query.prepare('select * from pacienti where nume=?')
        for k in 'b':
            self.query.addBindValue(QtCore.QVariant(QtCore.QString(self.cautat.text())))
            self.query.exec_()

the thing is only the second prepare works, I've tried the first
select in a sqlite shell and works, furthermore the above code will
print a twice in a single execution....could you please give me a hint
on what I'm doing wrong here. (I've tried this on 2 machines and got
the same thing). Thanks!


More information about the PyQt mailing list