PDA

View Full Version : QSqlQuery don't return



ShadowBelmolve
9th September 2010, 01:46
Hello, I'm having a strage problem, I'm using Qt 4.6.3 and sqlite 3.7.2 and a certain query return results from sqlite command line but don't return anything from QSqlQuery

The query


SELECT DISTINCT(incomings.id) FROM incomings JOIN incoming_products ON incoming_products.incoming_id = incomings.id WHERE incoming_products.name LIKE '%ar%'


a part of code


QSqlQuery query;
qDebug() << query.exec("SELECT DISTINCT(incomings.id) FROM incomings JOIN incoming_products ON incoming_products.incoming_id = incomings.id WHERE incoming_products.name LIKE '%ar%'");
qDebug() << query.size();


the output


true
-1


this is the only query of my app that don't work and the only thing I need to finish my app :(
anybody know why this don't work?

saa7_go
9th September 2010, 03:14
Look at this thread (http://www.qtcentre.org/threads/33317-QSqlQuery-not-working)

ShadowBelmolve
9th September 2010, 20:28
wow, thx, this lead me to real error, on setFilter of a QSqlRelationalTableModel I need to use table.field, only field don't work hehe