[PyQt] Qt and mysql
scorp1us at yahoo.com
Fri Aug 24 16:46:59 BST 2007
Don't you have to fetch a row or something first? I believe in Qt the record pointer is positioned BEFORE the first record so you have to fetchNext() to get the first one.
I ended up using the python API for my database work...
----- Original Message ----
From: Martin Alderete <malderete at gmail.com>
To: PyQt list <pyqt at riverbankcomputing.com>
Sent: Wednesday, August 22, 2007 10:40:53 PM
Subject: [PyQt] Qt and mysql
Hi! I have problems when i try to get values from sql query. I have
record in database but when i do the code below i recived None
objects..., I'm using mysql-server5.0, Qt4.3 and PyQt4.3 .... Can anybody check it?
self.manager = QtSql.QSqlDatabase("QMYSQL")
self.ok = self.manager.open();
string = QtCore.QString( "SELECT * from users")
query = QtSql.QSqlQuery(string, self.manager)
print "result: %s" % query.value(0).toString()
Pinpoint customers who are looking for what you sell.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt