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!