<?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[QSqlRecord saving changed does not work]]></title><description><![CDATA[<p dir="auto">Hello,<br />
I have a problem to update an existend record in a database.<br />
My table consists of some text and some boolean fields.<br />
Here the basic part of my code:</p>
<pre><code> QSqlTableModel t;       
//  configure  db, filter etc.    .........................
t.select();
QSqlRecord rec=t.record();  // get an empty record
//  fill the record fields with values .............
if(t.recordCount())   // only count = 1 is possible because of my logic
     t.setRecord(0,rec);
else
   t.insertRecord(0,rec);
t.submitAll();
</code></pre>
<p dir="auto">The insertRecord part works always .<br />
The setRecord part only t works if I change a least one boolean field in the record to the opposite value which is stored currently in the DB. Then the text field changes to new values too.<br />
But If I change only a text field no changes will be transmitted to the DB.<br />
I get no error, all seem to work but nothing changes in the DB.</p>
<p dir="auto">It seem that Qt  "thinks" that the record has not changed and skip the storing ?<br />
Can this be ?<br />
Why is there a difference betweent bool and string values ?</p>
<p dir="auto">How can i fix the problem ?</p>
]]></description><link>https://forum.qt.io/topic/61540/qsqlrecord-saving-changed-does-not-work</link><generator>RSS for Node</generator><lastBuildDate>Sat, 08 Aug 2026 12:38:57 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/61540.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 08 Dec 2015 19:37:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QSqlRecord saving changed does not work on Thu, 10 Dec 2015 11:05:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andy314">@<bdi>Andy314</bdi></a><br />
Its code when its best.. ;)</p>
]]></description><link>https://forum.qt.io/post/302091</link><guid isPermaLink="true">https://forum.qt.io/post/302091</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Thu, 10 Dec 2015 11:05:02 GMT</pubDate></item><item><title><![CDATA[Reply to QSqlRecord saving changed does not work on Thu, 10 Dec 2015 14:12:45 GMT]]></title><description><![CDATA[<p dir="auto">Yes, I have checked the errors of all function. Nowhere I get an error.<br />
I set all field to generated true.</p>
<p dir="auto">I had debugged a half day. Now the next day all works perfect suddenly without any code change. Misterious! Maybe some database log issue ???</p>
<p dir="auto">Thank you for your help.</p>
]]></description><link>https://forum.qt.io/post/302083</link><guid isPermaLink="true">https://forum.qt.io/post/302083</guid><dc:creator><![CDATA[Andy314]]></dc:creator><pubDate>Thu, 10 Dec 2015 14:12:45 GMT</pubDate></item><item><title><![CDATA[Reply to QSqlRecord saving changed does not work on Tue, 08 Dec 2015 20:40:41 GMT]]></title><description><![CDATA[<p dir="auto">Hi<br />
have you checked the return value of setRecord ?</p>
<p dir="auto"><a href="http://doc.qt.io/qt-5/qsqltablemodel.html#setRecord" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.io/qt-5/qsqltablemodel.html#setRecord</a></p>
<p dir="auto">Maybe there is something about the text field it don't like?</p>
]]></description><link>https://forum.qt.io/post/301803</link><guid isPermaLink="true">https://forum.qt.io/post/301803</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Tue, 08 Dec 2015 20:40:41 GMT</pubDate></item></channel></rss>