Results 1 to 6 of 6

Thread: [SOLVED QSQLLITE] Problem retrieving records

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2013
    Posts
    15
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default [SOLVED QSQLLITE] Problem retrieving records

    I have a problem retrieving data from a sqllite database, lasterror().text returns with "No query Unable to fetch row", running the query directly in the database gives me no issues and works.

    Qt Code:
    1. QStringList groups;
    2. QString SQL = "SELECT groups.name FROM groups "
    3. "INNER JOIN shiptypes ON groups.id = shiptypes.groupid "
    4. "INNER JOIN ships ON shiptypes.id = ships.shiptype "
    5. "INNER JOIN reports ON ships.id = reports.ship "
    6. "INNER JOIN posts ON posts.id = reports.postid "
    7. "WHERE posts.stamp = :stamp";
    8. QSqlQuery groupQuery(connection);
    9. groupQuery.prepare(SQL);
    10. groupQuery.bindValue(":stamp",reportKey);
    11. if (!groupQuery.exec()) {
    12. errorCode = 510;
    13. error = true;
    14. errorMessage = groupQuery.lastError().text();
    15. } else {
    16. while (groupQuery.next()) {
    17. groups.append(groupQuery.value(0).toString());
    18. }
    19. }
    To copy to clipboard, switch view to plain text mode 

    I've checked reportKey and it contains the correct value for WHERE clause, so that isn't an issue. I've also checked database connection and it connects successfully with database. Any suggestions?
    Last edited by skruffynerherder; 22nd February 2013 at 19:09.

Similar Threads

  1. Replies: 0
    Last Post: 31st July 2012, 11:10
  2. Problem retrieving data from class
    By prophet0 in forum Newbie
    Replies: 9
    Last Post: 11th March 2012, 08:14
  3. Problem During fatching records from QMAP container
    By lekhrajdeshmukh in forum Qt Programming
    Replies: 2
    Last Post: 27th October 2011, 13:12
  4. SQL Server data retrieving speed problem
    By Aleksandar in forum Qt Programming
    Replies: 4
    Last Post: 9th December 2010, 13:52
  5. Debugger problem retrieving data for watch view hangs
    By frenk_castle in forum Installation and Deployment
    Replies: 0
    Last Post: 5th May 2010, 23:09

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.