[PyQt] Qt and mysql

Jason H 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?

thank's!

Martin Alderete



self.manager = QtSql.QSqlDatabase("QMYSQL")

self.manager.setHostName("sherly");

self.manager.setDatabaseName("opencoffee");

self.manager.setUserName("opencoffee");

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. 
http://searchmarketing.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070824/e89bd4c5/attachment.html


More information about the PyQt mailing list