Quote Originally Posted by axel07 View Post
I'm getting frustated at it, do you know why?
The problem is in how QSqlDatabase handles the separators. E.g.:
Qt Code:
  1. QFile("e:/test.db"); // open will work
  2. db.setDatabaseName("e:/test.db"); // will not work, since it must be e:\test.db
To copy to clipboard, switch view to plain text mode 
So before setting a path to QSqlDatabase make following and it will work:
Qt Code:
  1. QString databaseFile("e:/path/to/database/file.db");
  2. QFileInfo info(databaseFile);
  3. databaseFile = QDir::toNativeSeparators(info.absoluteFilePath());
  4. db.setDatabaseName(databaseFile);
To copy to clipboard, switch view to plain text mode