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. QSqlQuery get response
Qt 6.11 is out! See what's new in the release blog

QSqlQuery get response

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.4k Views 2 Watching
  • 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.
  • X Offline
    X Offline
    Xeyos
    wrote on last edited by
    #1

    Hi,
    how can I get an answer to a query was successful?

    If there is an error I can clear query.lastError (). Text (), but if the query is correct as I get an answer, for example, that tells me the number of changed lines or if the table was created?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by mcosta
      #2

      Hi and welcome to devnet,

      you can use QSqlQuery::numRowsAffected for UPDATE statements.

      For table creation you can check the error.

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • X Offline
        X Offline
        Xeyos
        wrote on last edited by
        #3

        I try with DELETE and UPDATE, the tables are changed but the function return -1.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on last edited by
          #4

          Which driver are you using?

          As stated in the documentation not all drivers support this feature. Check with QSqlDriver::hasFeature() if is available for your driver

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          1 Reply Last reply
          0
          • X Offline
            X Offline
            Xeyos
            wrote on last edited by
            #5

            I use QPSQL. now try to check.
            Thanks for now.

            1 Reply Last reply
            0

            • Login

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