<?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[[SOLVED] parameter count mismatch sqlite and qt error]]></title><description><![CDATA[<p dir="auto">i have error with sqlite query</p>
<p dir="auto">i don't know where is the problem the problem exactly</p>
<p dir="auto">i have make a default connexion in mainwindow.cpp</p>
<p dir="auto">and i just get the default connexion and query the data base, but isn't works</p>
<p dir="auto">her is my code so far<br />
@<br />
QSqlDatabase db = QSqlDatabase::database() ;</p>
<p dir="auto">QSqlQuery query ;</p>
<p dir="auto">query.prepare("select seq from sqlite_sequence where name= ? ");</p>
<p dir="auto">query.addBindValue("articles");</p>
<p dir="auto">if(!query.exec())<br />
{<br />
QMessageBox::critical(this,"Inventoria solti",query.lastError().text());<br />
return ;<br />
}</p>
<p dir="auto">while (query.next())<br />
{<br />
ui-&gt;lineEdit-&gt;setText(query.value(0).toString());<br />
}@</p>
]]></description><link>https://forum.qt.io/topic/33107/solved-parameter-count-mismatch-sqlite-and-qt-error</link><generator>RSS for Node</generator><lastBuildDate>Sat, 07 Nov 2026 13:45:30 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/33107.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 15 Oct 2013 21:05:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [SOLVED] parameter count mismatch sqlite and qt error on Wed, 16 Oct 2013 09:36:40 GMT]]></title><description><![CDATA[<p dir="auto">sorry, p3c0, for the stupide error</p>
<p dir="auto">i don't write the path of database correctly</p>
<p dir="auto">i have writed</p>
<p dir="auto">this path  " E:\apprendreQt\gestionstock6\database\inventaire.db"</p>
<p dir="auto">instead of "E:/Programing/database/inventaire.db"</p>
<p dir="auto">int mainwindow.cpp</p>
<p dir="auto">her is the code of connexion</p>
<p dir="auto">@ m_db = new QSqlDatabase;<br />
// Base de données traitement<br />
*m_db = QSqlDatabase::addDatabase("QSQLITE") ;<br />
m_db-&gt;setHostName("localhost");<br />
m_db-&gt;setDatabaseName("E:/Programing/database/inventaire.db");<br />
m_db-&gt;setPassword("");<br />
m_db-&gt;setUserName("");<br />
if(!m_db-&gt;open())<br />
QMessageBox::critical(this,"erreur connecting",m_db-&gt;lastError().text());</p>
<pre><code>m_fenetreArticle = new article(this);
m_fenetreArticle-&gt;setWindowFlags(Qt::Window);@
</code></pre>
]]></description><link>https://forum.qt.io/post/199235</link><guid isPermaLink="true">https://forum.qt.io/post/199235</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Wed, 16 Oct 2013 09:36:40 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] parameter count mismatch sqlite and qt error on Wed, 16 Oct 2013 09:18:45 GMT]]></title><description><![CDATA[<p dir="auto">Thats strange the following coe works for me,<br />
@<br />
QSqlDatabase db  = QSqlDatabase::addDatabase("QSQLITE");<br />
db.setDatabaseName("/root/test.db");</p>
<p dir="auto">bool ret = db.open();</p>
<p dir="auto">QSqlQuery query(QSqlDatabase::database());<br />
QString str = "t1";<br />
query.exec("select seq from sqlite_sequence where name='"+str+"'");</p>
<p dir="auto">while (query.next()) {<br />
qDebug() &lt;&lt; query.value(0).toString();<br />
}<br />
@</p>
]]></description><link>https://forum.qt.io/post/199230</link><guid isPermaLink="true">https://forum.qt.io/post/199230</guid><dc:creator><![CDATA[p3c0]]></dc:creator><pubDate>Wed, 16 Oct 2013 09:18:45 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] parameter count mismatch sqlite and qt error on Wed, 16 Oct 2013 09:10:59 GMT]]></title><description><![CDATA[<p dir="auto">i tried your code and i get</p>
<p dir="auto">"no such table sqlite_sequence enable to execute statement" error</p>
]]></description><link>https://forum.qt.io/post/199228</link><guid isPermaLink="true">https://forum.qt.io/post/199228</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Wed, 16 Oct 2013 09:10:59 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] parameter count mismatch sqlite and qt error on Wed, 16 Oct 2013 08:17:56 GMT]]></title><description><![CDATA[<p dir="auto">Hi,<br />
You can alternatively try this,<br />
@<br />
QSqlQuery query(QSqlDatabase::database());<br />
query.exec(select seq from sqlite_sequence where name='"+str+"');<br />
while (query.next()) {<br />
qDebug() &lt;&lt; query.value(0).toInt();<br />
}<br />
@</p>
]]></description><link>https://forum.qt.io/post/199213</link><guid isPermaLink="true">https://forum.qt.io/post/199213</guid><dc:creator><![CDATA[p3c0]]></dc:creator><pubDate>Wed, 16 Oct 2013 08:17:56 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] parameter count mismatch sqlite and qt error on Wed, 16 Oct 2013 08:01:19 GMT]]></title><description><![CDATA[<p dir="auto">i tried this but i get the same error</p>
<p dir="auto">i don't know where is the problem every thing is correct , because i use the same code in other example  an it works</p>
<p dir="auto">@<br />
QSqlDatabase db = QSqlDatabase::database() ;</p>
<pre><code>QSqlQuery query(db) ;

QString queryString = "select seq from sqlite_sequence where name= ?";

query.prepare(queryString);

query.addBindValue(str);

if(!query.exec&amp;#40;&amp;#41;)
{
    QMessageBox::critical(this,tr("Inventaire"),query.lastError().text());
    return;
}

while(query.next())
{
    ui-&gt;articleCodeLineEdit-&gt;setText("ART_" + QString::number(query.value(0).toInt() + 1));
    return ;
}

if(ui-&gt;articleCodeLineEdit-&gt;text().isEmpty())
    ui-&gt;articleCodeLineEdit-&gt;setText("ART_1");
</code></pre>
<p dir="auto">@</p>
]]></description><link>https://forum.qt.io/post/199208</link><guid isPermaLink="true">https://forum.qt.io/post/199208</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Wed, 16 Oct 2013 08:01:19 GMT</pubDate></item><item><title><![CDATA[Reply to [SOLVED] parameter count mismatch sqlite and qt error on Wed, 16 Oct 2013 06:03:45 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I think you need to pass your "db" to your QSqlQuery query,<br />
Like this,<br />
@QSqlQuery query(db);@</p>
]]></description><link>https://forum.qt.io/post/199186</link><guid isPermaLink="true">https://forum.qt.io/post/199186</guid><dc:creator><![CDATA[p3c0]]></dc:creator><pubDate>Wed, 16 Oct 2013 06:03:45 GMT</pubDate></item></channel></rss>