Results 1 to 20 of 35

Thread: Multi Column selection from a Sqlite table

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    100
    Thanks
    38
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Multi Column selection from a Sqlite table

    hello .. I have a problem with multiple column selection, This is what i am doing to access a single column.. How could i select only the column names i.e( Channels ) which i have selected i have appended the list of selected column names in a QVector.. How can i use the column names from this vector in the query to access only those channel data.
    " QSqlQuery sq1("select Thermo2 from thdata where rowid = (" + QString::number(rowcnt) + ")");" Instead of a single column Thermo2 i need to pass how many ever channels were selected.. I have created a column for each channel in the db,say i have 300 columns for 300 channels.. In case i select only 100 columns in random i sud be able to retrieve only those columns of data.. I have all the selected channel names in a QVector called columnnames but don't know how to pass multiple columns to the Query . I am calling this function with a QTimer every 500 milli sec.

    Qt Code:
    1. QSqlQuery sq1("select Thermo2 from thdata where rowid = (" + QString::number(rowcnt) + ")");
    2. if(sq1.exec())
    3. {
    4. if (sq1.first())
    5. {
    6. do
    7. {
    8. for (int i = 0; i < tepdata.size(); ++i)
    9. {
    10. tepdata.push_back(sq1.value(i).toString());
    11. rowcnt++;
    12.  
    13. }
    14. } while(sq1.next());
    15. }
    16. //qDebug()<< tepdata
    To copy to clipboard, switch view to plain text mode 
    ;
    Pls help me ,i will be really great full this is very important for me.. i have been trying to get a solution past 2 days but have no answer, i searched a lot din't find any much help.

    thanks a lot.
    Last edited by nagabathula; 24th December 2010 at 07:57.

Similar Threads

  1. Replies: 0
    Last Post: 5th October 2010, 07:50
  2. Replies: 0
    Last Post: 25th June 2008, 18:36
  3. Can a QListView support multi-column?
    By wesley in forum Qt Programming
    Replies: 3
    Last Post: 7th March 2008, 08:00
  4. QListWidget multi selection
    By user in forum Qt Programming
    Replies: 1
    Last Post: 6th February 2008, 07:36
  5. Multi-selection Combo Box
    By EricF in forum Qt Programming
    Replies: 7
    Last Post: 7th November 2007, 07:15

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.