Results 1 to 5 of 5

Thread: QSqlQuery::value: not positioned on a valid record

  1. #1
    Join Date
    Mar 2010
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QSqlQuery::value: not positioned on a valid record

    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,

    Qt Code:
    1. int iResult = m_pSqlQuery[1].value(0).toInt(&bOk);
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 23rd October 2010 at 17:18.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QSqlQuery::value: not positioned on a valid record

    Are you calling QSqlQuery::next() prior to calling value()?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2010
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSqlQuery::value: not positioned on a valid record

    yes I have done this as well.please have look,
    Qt Code:
    1. m_pSqlQuery[1].exec();
    2. assert(m_pSqlQuery[1].isActive());
    3.  
    4. assert(m_pSqlQuery[1].next());
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 23rd October 2010 at 17:48.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QSqlQuery::value: not positioned on a valid record

    assert() is a no-op in release mode.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    chandan (23rd October 2010)

  6. #5
    Join Date
    Mar 2010
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSqlQuery::value: not positioned on a valid record

    Thanks. I have removed assert and the warning has gone.

Similar Threads

  1. Replies: 3
    Last Post: 26th March 2010, 04:32
  2. No valid Qt version set?
    By RoryWalsh in forum Qt Tools
    Replies: 4
    Last Post: 21st October 2009, 08:02
  3. error for No valid Qt version set
    By zhongxichuan in forum Qt Tools
    Replies: 2
    Last Post: 16th October 2009, 06:45
  4. QGLWidget::isValid() not valid in Qt-4.3.2?
    By Caius Aérobus in forum Qt Programming
    Replies: 3
    Last Post: 16th November 2008, 22:14
  5. valid a path name
    By klaus1111 in forum Newbie
    Replies: 3
    Last Post: 23rd July 2006, 15:07

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.