Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Ask for help (maybe) in query.value(0).

Ask for help (maybe) in query.value(0).

Scheduled Pinned Locked Moved Solved General and Desktop
qsqlquerymysqlselect
4 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • LuAriaL Offline
    LuAriaL Offline
    LuAria
    wrote on last edited by
    #1

    Here is the code:

    QString s = QString("SELECT Numone, Numtwo FROM number");
    query.exec(s);

    while(query.next()){
    QString name1 = query.value(0).toString();

    QString name2 = query.value(1).toString(); <--it,'s wrong T^T
    qDebug()<<name1; / /Numone
    qDebug()<<name2; / /Numtwo
    }

    I want it to output the data of both Numone and Numtwo, however, it just showed me Numone.
    How can I get the data of both Numone and Numtwo?
    Thanks every viewer.

    1 Reply Last reply
    0
    • Pradeep KumarP Offline
      Pradeep KumarP Offline
      Pradeep Kumar
      wrote on last edited by
      #2

      Hi,

      did u check wat value ur getting from dB, and
      is value present in dB for Numtwo?.

      Thanks,

      Pradeep Kumar
      Qt,QML Developer

      LuAriaL 1 Reply Last reply
      0
      • Pradeep KumarP Pradeep Kumar

        Hi,

        did u check wat value ur getting from dB, and
        is value present in dB for Numtwo?.

        Thanks,

        LuAriaL Offline
        LuAriaL Offline
        LuAria
        wrote on last edited by
        #3

        @Pradeep-Kumar Thanks for your respond!
        I have solved it after your suggestion.

        1 Reply Last reply
        1
        • Pradeep KumarP Offline
          Pradeep KumarP Offline
          Pradeep Kumar
          wrote on last edited by
          #4

          hi,

          @LuAria ,

          wat ws the value coming in Numtwo ?.
          Nways ur got solution.
          Happy coding.

          Thanks,

          Pradeep Kumar
          Qt,QML Developer

          1 Reply Last reply
          2

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved