Results 1 to 2 of 2

Thread: How to find result of a query in qsqlite?

  1. #1
    Join Date
    Oct 2009
    Posts
    19
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to find result of a query in qsqlite?

    Hi...previously i am gtk programmer(new to qt),

    qsqlquery.exec() function takes only one parameter which is query string. we are not passing any additional parameters to catch the results(like string * or ..etc).So how can i catch the result returned by sqlite database after running a qsqlquery.exec(). I have seen examples but they shown only how to enter the details in db. not shown how to catch the results(ex: table values, names ...etc) returned by db. please any one give me sample code lines for reading tables in sqlite database in qt 4.5.X? I think i have to use qsqlresult class. But i don't know how to use that class because i didnt found any examples which shows a proper code.
    Last edited by newtowindows; 28th October 2009 at 11:33. Reason: typo mistake

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to find result of a query in qsqlite?

    there is an example in Qt Assistant how to use QSqlQuery
    Qt Code:
    1. QSqlQuery query("SELECT country FROM artist");
    2. while (query.next()) {
    3. QString country = query.value(0).toString();
    4. doSomething(country);
    5. }
    To copy to clipboard, switch view to plain text mode 
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. Qt and VC++ instalation problem
    By gui.br in forum Installation and Deployment
    Replies: 6
    Last Post: 21st July 2009, 07:13
  2. Error executing SELECT query with QSQLITE
    By garfield85 in forum Qt Programming
    Replies: 6
    Last Post: 25th May 2009, 18:05
  3. problems installing Qt opensource with msvc2008 support
    By odin1985 in forum Installation and Deployment
    Replies: 6
    Last Post: 24th May 2008, 09:06
  4. Query keyboard state in Qt 3
    By Pieter from Belgium in forum Qt Programming
    Replies: 2
    Last Post: 9th February 2006, 17:20

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.