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. data from database is not shown
Qt 6.11 is out! See what's new in the release blog

data from database is not shown

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 383 Views 1 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.
  • C Offline
    C Offline
    Codmasters
    wrote on last edited by
    #1

    I have a form which is QMAINWINDOW and connected to Microsoft SQL Server database with some DROPBOXE and TABLEVIEWS when i receive data from database the boxes and tableview does not shown the data but i have rows number correctly but when i popup a QDialog window from my main the drop box in qdialog window show all the data in database.
    all the setting for both forms are same like each other.
    i have changed QMainWindow class to QDialog class nothing has changed.
    all data came from same database.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You are talking about QMainWindow and QDialog but you posted on the Qt Quick subforum, so which technology are you using ?

      In any case, you should provide relevant samples of your code so people can analyse it to help you determine what is going on.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • C Offline
        C Offline
        Codmasters
        wrote on last edited by
        #3

        yes you right my wrong i`ll repost it in correct place with my code TY .

        SGaistS 1 Reply Last reply
        0
        • C Codmasters

          yes you right my wrong i`ll repost it in correct place with my code TY .

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Codmasters said in data from database is not shown:

          yes you right my wrong i`ll repost it in correct place with my code TY .

          No need for that, I moved it.

          Can you share your code ?
          Your explanation is a bit unclear.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • C Offline
            C Offline
            Codmasters
            wrote on last edited by
            #5

            I solved the problem by accident.
            after I used QSqlQuery.exec the data in data table will NOT SHOW if and only if I use QSqlDatabase::database().close();
            so when i remove this part of code all the data where apeared perfectlly.

            Christian EhrlicherC 1 Reply Last reply
            0
            • C Codmasters

              I solved the problem by accident.
              after I used QSqlQuery.exec the data in data table will NOT SHOW if and only if I use QSqlDatabase::database().close();
              so when i remove this part of code all the data where apeared perfectlly.

              Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Codmasters Because QSqlDatabase::close() does actually close the database so how should the query get it's data afterwards?

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              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