I have a sqlite 3 database where I have some fake data just for testing, but it seems that every time I try to do a simple query it gives me the error that I mentioned in the title.

here's the code:

Qt Code:
  1. QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
  2. db.setDatabaseName("adtDB.sql");
  3. db.open();
  4. if(db.isOpen())
  5. {
  6. QSqlQuery q = db.exec("SELECT * FROM adt");
  7. if(q.exec())
  8. {
  9. qDebug()<<"works!";
  10. while(q.next())
  11. {
  12. qDebug()<<q.value(8).toString();
  13. }
  14. }
  15. qDebug()<<"---db failed to open! , error: "<<q.lastError().text();
  16. db.close();
  17. return true;
  18. }
  19. qDebug()<<"db failed to open! , error: "<<db.lastError().text();
  20. return false;
To copy to clipboard, switch view to plain text mode 

The database opens fine but this is the error that I get including the debug statement:
---db failed to open! , error: "No query Unable to fetch row"

the red text is the error the rest is in the debug statement that I included.