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 <[EMAIL PROTECTED]>
To: PyQt list <[email protected]>
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/
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to