Unsolved SQLite " Parameter count mismatch"
-
I am trying to run a simple select on the SQLite db. However i am getting the above mentioned error : " Parameter count mismatch
"bool DbLite::import(QString filename) { QSqlQuery query(mDb); query.prepare(".import :filename bisdata"); query.bindValue(":filename",filename); if(!query.exec()) { qDebug() << "SQLite : " << query.lastError().text(); return false; } else{ return true; } }
And this is how i am calling it.
if(mDbLite->import("bisdata.csv")){ qDebug() << "Import Successfull"; }
My Output :
SQLite : " Parameter count mismatch"
I also tried
query.prepare(".import ? bisdata"); query.bindValue(0,filename);
I Still get the same error.
-
The .import statement is not a Sql Statement.
The (.) dot commands are only for use inside the sqlite application.
The recommended way to import data into the database is the usage of the sqlite3 backup api.
(see: https://stackoverflow.com/questions/27014212/import-sqlite-database-using-qt-qsqldatabase )