Results 1 to 4 of 4

Thread: how to limit sql rows

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2007
    Location
    Grenoble, France
    Posts
    80
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 9 Times in 9 Posts

    Default Re: how to limit sql rows

    Thanks for your response. But it doesn't work for me. I get no rows at all when I add LIMIT to the filter.
    You have to run a level 3 diagnostic.

    Ashes to ashes, Qt to Qt ( wysota )

  2. #2
    Join Date
    Dec 2009
    Location
    Austria
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to limit sql rows

    Hi all!

    I think this happens because QSqlTableModel will call setSort after setFilter and this produces an Error (the LIMIT clause must be after any sorting clauses).

    As far as I know, the only solutions are:

    • Use QSqlQueryModel
    • Subclass QSqlTableModel and implement the function (e.g implement the setQuery function)


    I hope this can help.

Similar Threads

  1. QSqlTableModel inserts empty rows
    By Nesbitt in forum Qt Programming
    Replies: 2
    Last Post: 6th August 2008, 13:47
  2. Removing rows
    By indifference in forum Qt Programming
    Replies: 1
    Last Post: 30th August 2007, 17:54
  3. Replies: 1
    Last Post: 28th September 2006, 07:21

Tags for this Thread

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.