<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[BaseResult::exec: Parameter mismatch]]></title><description><![CDATA[<p dir="auto">Hi!<br />
An error occurred while editing the data in QSqlRelationalTableModel/QSqlTableModel.</p>
<p dir="auto">Error: QIBaseResult::exec: Parameter mismatch, expected 0, got 2 parameters</p>
<p dir="auto">Database Firebird 3.0, Qt 5.8, OS Ubuntu<br />
If use database MySQL, error does not occur, everything works.<br />
What could be the problem?</p>
]]></description><link>https://forum.qt.io/topic/80033/baseresult-exec-parameter-mismatch</link><generator>RSS for Node</generator><lastBuildDate>Sun, 20 Sep 2026 19:14:16 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/80033.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 Jun 2017 08:40:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to BaseResult::exec: Parameter mismatch on Mon, 17 Jul 2017 21:35:27 GMT]]></title><description><![CDATA[<p dir="auto">With:</p>
<pre><code>    query.addBindValue(ui-&gt;eNaziv-&gt;text());
    query.addBindValue(ui-&gt;eStanje-&gt;value());
    query.addBindValue(ui-&gt;eDatum-&gt;dateTime().toString());
</code></pre>
<p dir="auto">result is the same: QIBaseResult::exec: Parameter mismatch, expected 0, got 3 parameters</p>
]]></description><link>https://forum.qt.io/post/405166</link><guid isPermaLink="true">https://forum.qt.io/post/405166</guid><dc:creator><![CDATA[Navodar]]></dc:creator><pubDate>Mon, 17 Jul 2017 21:35:27 GMT</pubDate></item><item><title><![CDATA[Reply to BaseResult::exec: Parameter mismatch on Mon, 17 Jul 2017 21:29:40 GMT]]></title><description><![CDATA[<p dir="auto">What if you use <a href="http://doc.qt.io/qt-5/qsqlquery.html#addBindValue" target="_blank" rel="noopener noreferrer nofollow ugc">addBindValue</a> rather than bindValue ?</p>
]]></description><link>https://forum.qt.io/post/405160</link><guid isPermaLink="true">https://forum.qt.io/post/405160</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Mon, 17 Jul 2017 21:29:40 GMT</pubDate></item><item><title><![CDATA[Reply to BaseResult::exec: Parameter mismatch on Mon, 17 Jul 2017 16:50:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> here is result of executedQuery():<br />
"INSERT INTO MATERIJALI(NAZIV, STANJE_U_SILOSU, ZADNJA_POTROSNJA) VALUES(?, ?, ?)"</p>
]]></description><link>https://forum.qt.io/post/405140</link><guid isPermaLink="true">https://forum.qt.io/post/405140</guid><dc:creator><![CDATA[Navodar]]></dc:creator><pubDate>Mon, 17 Jul 2017 16:50:14 GMT</pubDate></item><item><title><![CDATA[Reply to BaseResult::exec: Parameter mismatch on Mon, 17 Jul 2017 04:50:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/navodar">@<bdi>Navodar</bdi></a> What does <a href="http://doc.qt.io/qt-5/qsqlquery.html#executedQuery" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.io/qt-5/qsqlquery.html#executedQuery</a> show?</p>
]]></description><link>https://forum.qt.io/post/404996</link><guid isPermaLink="true">https://forum.qt.io/post/404996</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Mon, 17 Jul 2017 04:50:09 GMT</pubDate></item><item><title><![CDATA[Reply to BaseResult::exec: Parameter mismatch on Sat, 15 Jul 2017 21:01:52 GMT]]></title><description><![CDATA[<p dir="auto">I have similar problem:</p>
<pre><code>    query.prepare("INSERT INTO MATERIJALI(NAZIV, STANJE_U_SILOSU, ZADNJA_POTROSNJA) VALUES(:naz, :sil, :pot)");
    query.bindValue(":naz", ui-&gt;eNaziv-&gt;text());
    query.bindValue(":sil", ui-&gt;eStanje-&gt;value());
    query.bindValue(":pot", ui-&gt;eDatum-&gt;dateTime().toString());
</code></pre>
<p dir="auto">return: QIBaseResult::exec: Parameter mismatch, expected 0, got 3 parameters</p>
<p dir="auto">It seems that QIBaseDriver don't support named placeholders. But when I try with positional placeholders, the result is the same:</p>
<pre><code>    query.prepare("INSERT INTO MATERIJALI(NAZIV, STANJE_U_SILOSU, ZADNJA_POTROSNJA) VALUES(?, ?, ?)");
    query.bindValue(0, ui-&gt;eNaziv-&gt;text());
    query.bindValue(1, ui-&gt;eStanje-&gt;value());
    query.bindValue(2, ui-&gt;eDatum-&gt;dateTime().toString());
</code></pre>
<p dir="auto">"QIBaseResult::exec: Parameter mismatch, expected 0, got 3 parameters".</p>
]]></description><link>https://forum.qt.io/post/404906</link><guid isPermaLink="true">https://forum.qt.io/post/404906</guid><dc:creator><![CDATA[Navodar]]></dc:creator><pubDate>Sat, 15 Jul 2017 21:01:52 GMT</pubDate></item><item><title><![CDATA[Reply to BaseResult::exec: Parameter mismatch on Mon, 12 Jun 2017 10:14:54 GMT]]></title><description><![CDATA[<p dir="auto">After changing the line, we go to another line. Changes are sent to the server Firebird. Query we transmitted to server by QSqlRelationalTableModel, but without filling in the parameters. Parameters must fill in QSqlRelationalTableModel, but it does not work for Firebird. With MySQL, there are no such problems.<br />
Sorry for bad English</p>
]]></description><link>https://forum.qt.io/post/398954</link><guid isPermaLink="true">https://forum.qt.io/post/398954</guid><dc:creator><![CDATA[Vitaliy WH]]></dc:creator><pubDate>Mon, 12 Jun 2017 10:14:54 GMT</pubDate></item><item><title><![CDATA[Reply to BaseResult::exec: Parameter mismatch on Mon, 12 Jun 2017 09:35:22 GMT]]></title><description><![CDATA[<pre><code>model-&gt;setEditStrategy(QSqlRelationalTableModel::OnRowChange);
</code></pre>
]]></description><link>https://forum.qt.io/post/398940</link><guid isPermaLink="true">https://forum.qt.io/post/398940</guid><dc:creator><![CDATA[Vitaliy WH]]></dc:creator><pubDate>Mon, 12 Jun 2017 09:35:22 GMT</pubDate></item><item><title><![CDATA[Reply to BaseResult::exec: Parameter mismatch on Sun, 11 Jun 2017 21:22:00 GMT]]></title><description><![CDATA[<p dir="auto">It's not very clear. Do you mean it happens when you add a new row ?</p>
]]></description><link>https://forum.qt.io/post/398839</link><guid isPermaLink="true">https://forum.qt.io/post/398839</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Sun, 11 Jun 2017 21:22:00 GMT</pubDate></item><item><title><![CDATA[Reply to BaseResult::exec: Parameter mismatch on Sun, 11 Jun 2017 07:55:29 GMT]]></title><description><![CDATA[<p dir="auto">When to we apply changes. In my case, when we move to new row in QTableView, this query sent to server. It turns out, Qt do not fill query parameters.  How to solve this problem?</p>
]]></description><link>https://forum.qt.io/post/398736</link><guid isPermaLink="true">https://forum.qt.io/post/398736</guid><dc:creator><![CDATA[Vitaliy WH]]></dc:creator><pubDate>Sun, 11 Jun 2017 07:55:29 GMT</pubDate></item><item><title><![CDATA[Reply to BaseResult::exec: Parameter mismatch on Sat, 10 Jun 2017 20:33:49 GMT]]></title><description><![CDATA[<p dir="auto">Looks like prepared query with anonymous placeholders.</p>
<p dir="auto">When exactly is that one called ?</p>
]]></description><link>https://forum.qt.io/post/398696</link><guid isPermaLink="true">https://forum.qt.io/post/398696</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Sat, 10 Jun 2017 20:33:49 GMT</pubDate></item><item><title><![CDATA[Reply to BaseResult::exec: Parameter mismatch on Sat, 10 Jun 2017 13:54:44 GMT]]></title><description><![CDATA[<p dir="auto">QT sent query:<br />
UPDATE users SET "PASSWD"=? WHERE "users"."ID" = ?<br />
On request it is visible that parameters are not set<br />
The question is why?</p>
]]></description><link>https://forum.qt.io/post/398656</link><guid isPermaLink="true">https://forum.qt.io/post/398656</guid><dc:creator><![CDATA[Vitaliy WH]]></dc:creator><pubDate>Sat, 10 Jun 2017 13:54:44 GMT</pubDate></item><item><title><![CDATA[Reply to BaseResult::exec: Parameter mismatch on Thu, 08 Jun 2017 19:32:41 GMT]]></title><description><![CDATA[<p dir="auto">You should check last error and query from your model. That might give you more clues about what is happening.</p>
]]></description><link>https://forum.qt.io/post/398308</link><guid isPermaLink="true">https://forum.qt.io/post/398308</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 08 Jun 2017 19:32:41 GMT</pubDate></item><item><title><![CDATA[Reply to BaseResult::exec: Parameter mismatch on Fri, 09 Jun 2017 09:41:38 GMT]]></title><description><![CDATA[<p dir="auto">I do not use the request, I'm using QTableView  + QSqlRelationalTableModel</p>
<pre><code>#include "listform.h"
#include &lt;QVBoxLayout&gt;
#include &lt;QAbstractItemView&gt;
#include &lt;QHeaderView&gt;
#include &lt;QSqlRelationalDelegate&gt;

ListForm::ListForm(QWidget *parent)
{
    QVBoxLayout *vl = new QVBoxLayout(parent);
    toolBar = new QToolBar(parent);
    tableView = new QTableView(parent);
    tableView-&gt;setSelectionBehavior(QAbstractItemView::SelectRows);
    tableView-&gt;setSelectionMode(QAbstractItemView::SingleSelection);
    tableView-&gt;resizeColumnsToContents();
    tableView-&gt;horizontalHeader()-&gt;setStretchLastSection(true);
    tableView-&gt;setItemDelegate(new QSqlRelationalDelegate);


    vl-&gt;addWidget(toolBar);
    vl-&gt;addWidget(tableView);

    this-&gt;setLayout(vl);

    actionNew = new QAction(toolBar);
    actionNew-&gt;setIcon(QIcon(":images/new.png"));

    actionEdit = new QAction(toolBar);
    actionEdit-&gt;setIcon(QIcon(":images/edit.png"));

    actionDelete = new QAction(toolBar);
    actionDelete-&gt;setIcon(QIcon(":images/delete.png"));

    actionRefresh = new QAction(toolBar);
    actionRefresh-&gt;setIcon(QIcon(":images/refresh.png"));

    toolBar-&gt;addAction(actionNew);
    toolBar-&gt;addAction(actionEdit);
    toolBar-&gt;addSeparator();
    toolBar-&gt;addAction(actionDelete);
    toolBar-&gt;addSeparator();
    toolBar-&gt;addAction(actionRefresh);
}

void ListForm::setModel(QSqlRelationalTableModel *model)
{
    tableView-&gt;setModel(model);

}

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui-&gt;setupUi(this);

    QSqlDatabase db = QSqlDatabase::addDatabase("QIBASE");
    db.setHostName("localhost");
    db.setDatabaseName("/home/vital/WMS/db/wms.fdb");
    db.setUserName("SYSDBA");
    db.setPassword("masterkey");

//    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
//    db.setHostName("localhost");
//    db.setDatabaseName("jTrade");
//    db.setUserName("root");
//    db.setPassword("Gladiator#2017");

    if (!db.open()) {
        qDebug() &lt;&lt; "Cannot open DB!" &lt;&lt; db.lastError();
    } else
        qDebug() &lt;&lt; "Connect to DB!";


    QSqlRelationalTableModel *model = new QSqlRelationalTableModel(this);
    model-&gt;setTable("users");
    model-&gt;setRelation(model-&gt;fieldIndex("id_employee"),QSqlRelation("employees","id","name"));
    model-&gt;select();
    model-&gt;setEditStrategy(QSqlTableModel::OnRowChange);
    model-&gt;setSort(model-&gt;fieldIndex("name"),Qt::AscendingOrder);

    ListForm *lf = new ListForm();
    lf-&gt;setParent(this,Qt::Window);
    lf-&gt;show();
    lf-&gt;setModel(model);
}
</code></pre>
<p dir="auto"><em>[Added code tags ~kshegunov]</em></p>
]]></description><link>https://forum.qt.io/post/398147</link><guid isPermaLink="true">https://forum.qt.io/post/398147</guid><dc:creator><![CDATA[Vitaliy WH]]></dc:creator><pubDate>Fri, 09 Jun 2017 09:41:38 GMT</pubDate></item><item><title><![CDATA[Reply to BaseResult::exec: Parameter mismatch on Wed, 07 Jun 2017 21:31:46 GMT]]></title><description><![CDATA[<p dir="auto">Hi and  welcome to devnet,</p>
<p dir="auto">Can you show the query you are using ?</p>
]]></description><link>https://forum.qt.io/post/398024</link><guid isPermaLink="true">https://forum.qt.io/post/398024</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 07 Jun 2017 21:31:46 GMT</pubDate></item></channel></rss>