I am using VS2008 & QT plugin to make my application. After making package when I am running the application I am getting error :
QSqlDatabase: QSQLITE driver not loaded
QSqlDatabase: available drivers:
Database error: QSqlError(-1, "Driver not loaded", "Driver not loaded")
QSqlError(-1, "Driver not loaded", "Driver not loaded")
I have added the qsqlite.dll to my package & also changed the libpath. But still I am getting this error. How to solve this.
My Code::
QStringList str;
str.append(".");
a.setLibraryPaths(str);
a.addLibraryPath("./sqldrivers/");
//a.addLibraryPath(".");
qDebug()<<"my library path : "<<a.libraryPaths();
QLibrary sqlib("qsqlite4.dll");
sqlib.load();
qDebug()<<"my library loaded"<<sqlib.isLoaded();
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
qDebug()<<"Database error:"<<db.lastError();
db.setDatabaseName("vimukti1234");
qDebug()<< db.lastError();
db.open();
QSqlQuery query;
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…