Hi to all!
Here is the code:
QString queryString
("SELECT * from merchandize WHERE GrupaIdentificationNumber=%1;");
//QString queryString("SELECT * from merchandize WHERE GrupaIdentificationNumber=2;"); // test
queryString=queryString.arg(groupId);
qDebug() << "Query: " << queryString; // debug
QSqlQuery query
(queryString
);
// sets up query from query string removeAllMerchandize(); // removes all items
m_iImageCounter=0; // inits counter
//query.exec(queryString); // executes query string
while (query.next())
{
.....
}
QString queryString("SELECT * from merchandize WHERE GrupaIdentificationNumber=%1;");
//QString queryString("SELECT * from merchandize WHERE GrupaIdentificationNumber=2;"); // test
queryString=queryString.arg(groupId);
qDebug() << "Query: " << queryString; // debug
QSqlQuery query(queryString); // sets up query from query string
removeAllMerchandize(); // removes all items
m_iImageCounter=0; // inits counter
//query.exec(queryString); // executes query string
while (query.next())
{
.....
}
To copy to clipboard, switch view to plain text mode
As you can see, I've debugged created query and it is ok. But why the program flow skips while loop. The database is filled and the application is connected to it as it must be. I thought there is something wrong with query itself, but as I copied quey, which was produces with qDebug() and pasted it into mysql by hand, I got right results. Can someone help me please?
Bookmarks