Quote Originally Posted by ad5xj View Post
Here is the relevant code from connection.h:
First of all you shouldn't put code in .h files --- only declarations.

Quote Originally Posted by ad5xj View Post
QSqlDatabase * DB = QSqlDatabase::addDatabase("QSQLITE");
Here you declare a new local variable DB, which has nothing to do (except for the name) with the DB variable from your previous post.

Quote Originally Posted by ad5xj View Post
db.setDatabaseName("DBName");
Does this even compile? Note that variable names are case sensitive, so there's a difference between db and DB.