[PyQt] qtable data source

Andreas Pakulat apaku at gmx.de
Sun Dec 23 19:33:35 GMT 2007


On 23.12.07 11:05:18, nishith datta wrote:
> Ok ,
>   I went throught he documentation before and yet again.
>   I can't figure out what the hell is wrong with this code ;-
>   import sys
> >from PyQt4 import QtGui, QtSql
>    
>   db = QtSql.QSqlDatabase.addDatabase("QPSQL")
> db.setHostName("localhost")
> db.setPort(5432)
> db.setDatabaseName("test")
> db.setUserName("root")
> db.setPassword("mypass")
> print db.open()
>    
>   Always returns a false , however with psycopg2 , I am able to execute query too. 

You don't create a QApplication or QCoreApplication, thats needed before
doing any sql-stuff with Qt. It works fine over here.

Andreas

-- 
Don't go surfing in South Dakota for a while.


More information about the PyQt mailing list