Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. SQLite " Parameter count mismatch"
Forum Updated to NodeBB v4.3 + New Features

SQLite " Parameter count mismatch"

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 751 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bongani
    wrote on 6 Dec 2017, 08:02 last edited by
    #1

    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.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      karlheinzreichel
      wrote on 6 Dec 2017, 08:42 last edited by
      #2

      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 )

      1 Reply Last reply
      2

      1/2

      6 Dec 2017, 08:02

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved