Results 1 to 3 of 3

Thread: what is going on a QSqlQuery?

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

    Question what is going on a QSqlQuery?

    hello every body,
    i have a problem with QSqlQuery
    i built a query easy and i went to the first record by using
    Qt Code:
    1. query->next()
    To copy to clipboard, switch view to plain text mode 
    until now every thing works fine later in the program i used
    Qt Code:
    1. query->seek(id)
    To copy to clipboard, switch view to plain text mode 
    the query went to the record i want because i investigate that by trying
    Qt Code:
    1. query->at()
    To copy to clipboard, switch view to plain text mode 
    i found it on the roght record but when i try to get the text from the record no thing return
    Qt Code:
    1. query->value(0).toString()
    To copy to clipboard, switch view to plain text mode 

    but, but
    when i used
    Qt Code:
    1. query->last()
    To copy to clipboard, switch view to plain text mode 
    before
    Qt Code:
    1. query->seek(id)
    To copy to clipboard, switch view to plain text mode 
    every thing works fine
    i want to know why?
    and thank you

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: what is going on a QSqlQuery?

    Some database doesn't know the query size QSqlDriver::hasFeature()
    In this case before to use QSqlQuery::seek() or QSqlQuery::size() you have to go to the last record.
    A camel can go 14 days without drink,
    I can't!!!

  3. #3
    Join Date
    Jan 2008
    Posts
    58
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: what is going on a QSqlQuery?

    Try query.value(0).toString()

Similar Threads

  1. QSqlQuery problem
    By MarkoSan in forum Qt Programming
    Replies: 11
    Last Post: 18th December 2007, 13:25
  2. QSqlQuery error
    By skuda in forum Qt Programming
    Replies: 2
    Last Post: 2nd November 2007, 08:43
  3. Batch update fails with QSqlQuery
    By William Wilson in forum Qt Programming
    Replies: 2
    Last Post: 20th July 2007, 15:36
  4. How can I get the number of columns in QSqlQuery.
    By fengtian.we in forum Qt Programming
    Replies: 1
    Last Post: 21st May 2007, 11:04
  5. Problems with QSqlQuery update
    By whoops.slo in forum Qt Programming
    Replies: 4
    Last Post: 28th August 2006, 07:17

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.