PDA

View Full Version : QSqlQuery::value: not positioned on a valid record



chandan
23rd October 2010, 17:12
Hi Everyone,
I have written a UI which was working fine in debug mode. But when I have tried to execute the same code in release I am getting the following warning.
"QSqlQuery::value: not positioned on a valid record".

But except of this warning, everything else is working fine. Now my question is how to remove this warning please? Code stated below is giving the above warning,


int iResult = m_pSqlQuery[1].value(0).toInt(&bOk);

wysota
23rd October 2010, 17:17
Are you calling QSqlQuery::next() prior to calling value()?

chandan
23rd October 2010, 17:38
yes I have done this as well.please have look,


m_pSqlQuery[1].exec();
assert(m_pSqlQuery[1].isActive());

assert(m_pSqlQuery[1].next());

wysota
23rd October 2010, 17:49
assert() is a no-op in release mode.

chandan
23rd October 2010, 17:54
Thanks. I have removed assert and the warning has gone.