Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
QDataTable & PostgreSQL
Hello everybody! I am working on a Database now.
I set up a Database and then a Table under PostgreSQL 8.3. I used the code below to set up a connection:
QSqlDatabase *defaultDB = QSqlDatabase::addDatabase( DB_BOOKS_DRIVER );
defaultDB->setDatabaseName( DB_BOOKS );
defaultDB->setUserName( DB_BOOKS_USER );
defaultDB->setPassword( DB_BOOKS_PASSWD );
defaultDB->setHostName( DB_BOOKS_HOST );
if ( ! defaultDB->open() ) {
qWarning( "Failed to open books database: " +
defaultDB->lastError().driverText() );
qWarning( defaultDB->lastError().databaseText() );
return FALSE;
And it's OK.
I used a QDataTable to access Database. I select the certain table I set up in pgAdmin. But a error ocurred when I click the Preview Button(Qt Designer).
Would you please give some advice to me ? Thanks a lot!
RE: QDataTable & PostgreSQL
I did all these work under windows.