Results 1 to 5 of 5

Thread: from sqlquery to qstringlist

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2011
    Posts
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default from sqlquery to qstringlist

    try to read a sqlquery, save it into a qstringlist and set it to combobox.
    pass compile but combobox is empty.
    Qt Code:
    1. QStringList cblist;
    2. QSqlQuery query;
    3. query.prepare("SELECT lastname FROM employeestuf");
    4. query.exec();
    5. while(query.next())
    6. {
    7. if (query.isValid())
    8. cblist<<query.value(0).toString();
    9. }
    10.  
    11. ui->comboBox->addItems(cblist);
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files

Similar Threads

  1. Help QStringList
    By pcoliver in forum Qt Programming
    Replies: 0
    Last Post: 15th September 2011, 10:15
  2. sqlQuery executing return nothing
    By ar_a24 in forum Qt Programming
    Replies: 0
    Last Post: 26th February 2011, 06:04
  3. SQLQUERY - column value retrun problem
    By damodharan in forum Qt Programming
    Replies: 7
    Last Post: 27th May 2010, 07:09
  4. Casting in a select sqlQuery
    By Kesy in forum Qt Programming
    Replies: 3
    Last Post: 25th November 2008, 15:12
  5. Replies: 7
    Last Post: 2nd June 2006, 12:48

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.