[Qt-interest] QSqlQuery and QSqlTableModel show empty

Jon Flowers Jon.Flowers at pgs.com
Fri May 15 11:17:59 CEST 2009


Need some help with the Sql Modules.

I have read some of the books out there and looked at the examples. I
have a postgres database up and running with a table and one row in it.
I can create a connection to this database from main.cpp, but I would
like to use the QSqlTableModel on the mainwindow.cpp class. I have
queried the connection and it says it is active, but when I follow
example to show the table on the gui I get the columns in the header,
but no data. I have tried to get a QSqlQuery to just test things and it
also returns no data. 

...
projModel.setTable("tablename");
projModel.select();

ui.tbvProjects->setModel(&projModel);
ui.tbcProjects->show();

No data comes back but the headers are correct. So that leads me to
believe I do have a connection but the query is not returning any data.
And to answer the obvious, I have verified the table contains data by
pgAdmin from a different machine and also via psql on the database
server (local dev machine).

Any ideas, pointers and general comments welcome....

Thanks
Jon

This email and any files contained therein is confidential and may contain privileged information.  If you are not the named addressee(s) or you have otherwise received this in error, you should not distribute or copy this e-mail or use any of its content for any purpose. Please notify the sender immediately by e-mail if you have received this e-mail in error and delete it from your system
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090515/672ee17d/attachment.html 


More information about the Qt-interest-old mailing list