duave,

The only thing that I see strange with your code is the following line but then I am no expert either.

Qt Code:
  1. timingDatabase = QSqlDatabase::addDatabase("QSQLITE", "timing");
To copy to clipboard, switch view to plain text mode 

I am not sure about the "timing" being in the definition. To do what you want I did it this way:

Qt Code:
  1. timeQuery.exec( "CREATE TABLE IF NOT EXISTS timing ("
  2. "`line1` varchar(10) default NULL,"
  3. "`line2` varchar(10) default NULL,"
  4. "`line3` varchar(10) default NULL)" );
  5. if (!timeQuery.isActive() )
  6. {
  7. QMessageBox::critical(this, "Error", "Table Creation Failed! \n"
  8. "\n"+dbqry.lastError().text()+"n"+timingDatabase.driverName() );
  9. }
To copy to clipboard, switch view to plain text mode 

I have an application that requires three tables and I use this method to check each table is there. If not, its created. Also, the the database is created if not there either.

Hope this helps.

B1.