Friday, July 25th 2008, 2:39am UTC+1

You are not logged in.

  • Login
  • Register

1

Thursday, April 24th 2008, 4:25am

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!
  • Go to the top of the page

2

Thursday, April 24th 2008, 7:35am

RE: QDataTable & PostgreSQL

I did all these work under windows.
  • Go to the top of the page

Rate this thread