<?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[QSqlQueryModel dont show any row]]></title><description><![CDATA[<p dir="auto">Hi, sorry for my english in advance :)</p>
<p dir="auto">First i try the code below on sql developer and works fine:</p>
<p dir="auto">FECHA IS A ORACLE DATE TYPE</p>
<p dir="auto">@<br />
SELECT idgasto, concepto, monto, TO_CHAR(fecha, 'dd-MM-yyyy'), observaciones<br />
FROM GASTOS WHERE concepto='KEVIN'<br />
AND TO_DATE(fecha,'dd-MM-yyyy') &gt;= TO_DATE('01-09-1988' ,'dd-MM-yyyy')<br />
AND TO_DATE(fecha,'dd-MM-yyyy') &lt; TO_DATE('1-10-1988','dd-MM-yyyy')<br />
ORDER BY (fecha)<br />
@</p>
<p dir="auto">i get 1 row (the onlyone i had on this table):</p>
<p dir="auto">@<br />
IDGASTO  CONCEPTO  MONTO  TO_CHAR(FECHA,'DD-MM-YYYY')  OBSERVACIONES</p>
<hr />
<p dir="auto">3        KEVIN     10000  12-09-1988                   aaaaaaaaaaaaa<br />
@</p>
<p dir="auto">so when i try the code below in my model i get 0 rows</p>
<p dir="auto">@<br />
void BuscarGasto::on_pushButtonBuscar_clicked()<br />
{<br />
model-&gt;setQuery("SELECT idgasto, concepto, monto, TO_CHAR(fecha, 'dd-MM-yyyy'), observaciones "<br />
" FROM GASTOS WHERE concepto='KEVIN' "<br />
" AND TO_DATE(fecha,'dd-MM-yyyy') &gt;= TO_DATE('01-09-1988' ,'dd-MM-yyyy')  "<br />
" AND TO_DATE(fecha,'dd-MM-yyyy') &lt; TO_DATE('1-10-1988','dd-MM-yyyy') "<br />
" ORDER BY (fecha) ", db);<br />
qDebug()&lt;&lt;model-&gt;query().lastError().text();<br />
ui-&gt;tableView-&gt;setModel(model);<br />
}<br />
@</p>
<p dir="auto">but when i try the code below i get the same row that i got with sqldeveloper so....:</p>
<p dir="auto">@<br />
void BuscarGasto::on_pushButtonBuscar_clicked()<br />
{<br />
model-&gt;setQuery("SELECT idgasto, concepto, monto, TO_CHAR(fecha, 'dd-MM-yyyy'), observaciones "<br />
" FROM GASTOS WHERE concepto='KEVIN' "<br />
" ORDER BY (fecha) ", db);<br />
qDebug()&lt;&lt;model-&gt;query().lastError().text();<br />
ui-&gt;tableView-&gt;setModel(model);<br />
}<br />
@</p>
<p dir="auto">so the problem is somewhere in the lines below wich are exactly the same as i tried on sqldeveloper....</p>
<p dir="auto">@<br />
" AND TO_DATE(fecha,'dd-MM-yyyy') &gt;= TO_DATE('01-09-1988' ,'dd-MM-yyyy')  "<br />
" AND TO_DATE(fecha,'dd-MM-yyyy') &lt; TO_DATE('1-10-1988','dd-MM-yyyy') "<br />
@</p>
<p dir="auto">the ouput of qDebug() is  " ";</p>
<p dir="auto">other information: i use oracle express edition 11g</p>
<p dir="auto">so no clue where is the problem i tried everything that came to my head :(</p>
<p dir="auto">i dont post more information bcz the post is already to long and i dont think more infomation gona be usefull</p>
]]></description><link>https://forum.qt.io/topic/37874/qsqlquerymodel-dont-show-any-row</link><generator>RSS for Node</generator><lastBuildDate>Tue, 22 Sep 2026 01:46:02 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/37874.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 16 Feb 2014 03:23:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QSqlQueryModel dont show any row on Sun, 16 Feb 2014 18:21:22 GMT]]></title><description><![CDATA[<p dir="auto">the code is exactly the same in sqldeveloper and in my code.... i use both functions in both codes... TO_CHAR for the data i retrieve taht is just what i am going to show i that column,  and TO_DATE is the condition that the data have to sastisfy...</p>
<p dir="auto">sorry i did not make my self clear but i MUST use TO_DATE so i can compare them ... fecha and my string  '1-10-1988'  have to be same type to do that.</p>
]]></description><link>https://forum.qt.io/post/215108</link><guid isPermaLink="true">https://forum.qt.io/post/215108</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Sun, 16 Feb 2014 18:21:22 GMT</pubDate></item><item><title><![CDATA[Reply to QSqlQueryModel dont show any row on Sun, 16 Feb 2014 17:46:47 GMT]]></title><description><![CDATA[<p dir="auto">in your sql developer you use TO_CHAR with fecha - which is OK, but in the WHERE clause of your Qt query you use TO_DATE - this might be the problem as you try to convert a date to date?</p>
]]></description><link>https://forum.qt.io/post/215103</link><guid isPermaLink="true">https://forum.qt.io/post/215103</guid><dc:creator><![CDATA[clochydd]]></dc:creator><pubDate>Sun, 16 Feb 2014 17:46:47 GMT</pubDate></item><item><title><![CDATA[Reply to QSqlQueryModel dont show any row on Sun, 16 Feb 2014 16:44:02 GMT]]></title><description><![CDATA[<p dir="auto">but is the only way to compare qt qdate field with oracle date field and works when i try the same line in my sql developer so... thanks any way for your replies!! :)</p>
]]></description><link>https://forum.qt.io/post/215101</link><guid isPermaLink="true">https://forum.qt.io/post/215101</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Sun, 16 Feb 2014 16:44:02 GMT</pubDate></item><item><title><![CDATA[Reply to QSqlQueryModel dont show any row on Sun, 16 Feb 2014 16:28:18 GMT]]></title><description><![CDATA[<p dir="auto">Unfortunately I'm not sure if my suggestion will work as I'm not familiar with Oracle. But your problem ist somewhere in the conversion of the date types and you should try without TO_DATE - especially for the field fecha from your database</p>
]]></description><link>https://forum.qt.io/post/215098</link><guid isPermaLink="true">https://forum.qt.io/post/215098</guid><dc:creator><![CDATA[clochydd]]></dc:creator><pubDate>Sun, 16 Feb 2014 16:28:18 GMT</pubDate></item><item><title><![CDATA[Reply to QSqlQueryModel dont show any row on Sun, 16 Feb 2014 16:10:16 GMT]]></title><description><![CDATA[<p dir="auto">fecha is a oracle DATE TYPE</p>
]]></description><link>https://forum.qt.io/post/215095</link><guid isPermaLink="true">https://forum.qt.io/post/215095</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Sun, 16 Feb 2014 16:10:16 GMT</pubDate></item><item><title><![CDATA[Reply to QSqlQueryModel dont show any row on Sun, 16 Feb 2014 13:00:23 GMT]]></title><description><![CDATA[<p dir="auto">What is the type and content of your field "fecha"?<br />
Have you tried to use for compare<br />
fecha::date &gt;= '19880901' AND fecha::date &lt; '19881001'?</p>
]]></description><link>https://forum.qt.io/post/215080</link><guid isPermaLink="true">https://forum.qt.io/post/215080</guid><dc:creator><![CDATA[clochydd]]></dc:creator><pubDate>Sun, 16 Feb 2014 13:00:23 GMT</pubDate></item></channel></rss>