Results 1 to 20 of 25

Thread: QSqlQuery::isValid returns false

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2008
    Posts
    154
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    12

    Default Re: QSqlQuery::isValid returns false

    excuse me but i dont know how to enable the console.
    i am using visual studio 2005.
    i hope, i am not wasting your time.
    but i believe if i want to learn some thing i must start my project directly as sayed in Qt documentation .but on the road there are missed things.
    thank you

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

    Default Re: QSqlQuery::isValid returns false

    If you're using a commercial licence then access your project options using the integration plugin and it should be there somewhere. If not, run your application from within VS debugger and it should display the message. As an alternative, prepare a small qmake project and include a CONFIG+=console line in it.

  3. #3
    Join Date
    Feb 2008
    Posts
    154
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    12

    Default Re: QSqlQuery::isValid returns false

    i made as you said and i get the following output:
    1
    QSqlQuery::value: not positioned on a valid record

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

    Default Re: QSqlQuery::isValid returns false

    How many records does the table hold?

  5. #5
    Join Date
    Feb 2008
    Posts
    154
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    12

    Default Re: QSqlQuery::isValid returns false

    i tried it with two databases
    one of them contains three records
    and the other one contains 90 records.

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

    Default Re: QSqlQuery::isValid returns false

    Could you prepare a minimal compilable example reproducing the problem?

  7. #7
    Join Date
    Feb 2008
    Posts
    154
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    12

    Default Re: QSqlQuery::isValid returns false

    here, it is the source code .
    http://www.filesend.net/download.php...df51c62f649b7c

    please dont forget to put the sample database in the ( c:\ ) directory.
    the database are contained in the Zip file and also the *.pro file.

  8. #8
    Join Date
    Feb 2008
    Posts
    154
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    12

    Default Re: QSqlQuery::isValid returns false

    i tried the same code with Sqlite database and the program works fine.
    but why does not it work with MS access?

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

    Default Re: QSqlQuery::isValid returns false

    As I (think I) already said, maybe Access only supports sequential access to data.

  10. #10
    Join Date
    Feb 2008
    Posts
    154
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    12

    Default Re: QSqlQuery::isValid returns false

    do you mean that i can not deal with access databases with Qt?

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

    Default Re: QSqlQuery::isValid returns false

    No, I mean Access databases can't jump across the result set regardless if you use Qt or not. If you want to reach the last entry, you have to iterate each record one by one until you reach the end.

  12. #12
    Join Date
    Feb 2008
    Posts
    154
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    12

    Default Re: QSqlQuery::isValid returns false

    but i have the program that deal with access database which is built using visual basic
    and this program go through the database easy it make last , first, next and previous
    and i want to rebuild this program using c++. it means that the database support non sequential access
    as well as sequential.

Similar Threads

  1. Replies: 4
    Last Post: 8th July 2007, 14:26
  2. connect returns false
    By krivenok in forum Qt Programming
    Replies: 6
    Last Post: 21st February 2006, 20:01

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
  •  
Qt is a trademark of The Qt Company.