<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">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.<br><br>I ended up using the python API for my database work...<br><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: Martin Alderete <malderete@gmail.com><br>To: PyQt list <pyqt@riverbankcomputing.com><br>Sent: Wednesday, August 22, 2007 10:40:53 PM<br>Subject: [PyQt] Qt and mysql<br><br>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?<br><br>thank's!<br><br>Martin Alderete<br>
<br>
self.manager = QtSql.QSqlDatabase("QMYSQL")<br>
self.manager.setHostName("sherly");<br>
self.manager.setDatabaseName("opencoffee");<br>
self.manager.setUserName("opencoffee");<br>
self.ok = self.manager.open();<br>
string = QtCore.QString( "SELECT * from users")<br>
query = QtSql.QSqlQuery(string, self.manager)<br>
print "result: %s" % query.value(0).toString()
</div><br></div></div><br>
<hr size=1>Ready for the edge of your seat?
<a href="http://us.rd.yahoo.com/evt=48220/*http://tv.yahoo.com/">Check out tonight's top picks</a> on Yahoo! TV.
</body></html>