You need to add qsql dll files for Microsoft Access Driver within your sqldrivers folder
Check following if you are debugging
- check your project settings for dll reference(in .pro file of your project, you have to put QT += sql, if you are using Visual studio integration you check reference in project settings form properties)
- check you Qtdirectory for driver folder and dll's
If you are distributing your app, you just copy sql driver folder also with your executable along with required dlls.
edit your QSqlQuery object binded with database connection
db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb};FIL={MSAccess};DBQ=C:/Users/user/Desktop/Final_Version/db.mdb");
database.open();
QSqlQuery query(db);
query.exec("Select ID from TestId");
while(query.next())
{
TestId = query.value(0).toInt();
}
db.close();
I think, some of this will help you... :)