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. Too long to load data from Sql Server
Qt 6.11 is out! See what's new in the release blog

Too long to load data from Sql Server

Scheduled Pinned Locked Moved Unsolved General and Desktop
23 Posts 6 Posters 5.7k 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.
  • Christian EhrlicherC Offline
    Christian EhrlicherC Offline
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #11

    And how do you know that it's because of the query model?
    What Qt version do you use?

    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
    • D Offline
      D Offline
      Duy Khang
      wrote on last edited by
      #12

      because if i don't use the query model then when click to Xem push button, it's work
      and if i use the query model. it takes about 30s to load data from SQL Server.
      Version is Qt Creator 4.14.0

      1 Reply Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #13

        @Duy-Khang said in Too long to load data from Sql Server:

        click to Xem push button, it's work

        ?

        Version is Qt Creator 4.14.0

        we don't care which IDE (and it's version) you use - we want to use what Qt version you're using for developing.

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

        Pl45m4P 1 Reply Last reply
        0
        • D Offline
          D Offline
          Duy Khang
          wrote on last edited by
          #14

          Sorry for my English. i'm using Qt5

          JonBJ 1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            @Duy-Khang said in Too long to load data from Sql Server:

            click to Xem push button, it's work

            ?

            Version is Qt Creator 4.14.0

            we don't care which IDE (and it's version) you use - we want to use what Qt version you're using for developing.

            Pl45m4P Offline
            Pl45m4P Offline
            Pl45m4
            wrote on last edited by Pl45m4
            #15

            @Christian-Ehrlicher

            I assume @Duy-Khang is using 5.15.2 MinGW (the debug output, you can see in the screenshot). So it's probably not some weird buggy behavior

            @Duy-Khang have you tried any other query or any other database? Can you print the query result to console?
            Set breakpoints to see where it crashes (during the query execution or while filling your tableView/model with data).


            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

            ~E. W. Dijkstra

            1 Reply Last reply
            0
            • D Offline
              D Offline
              Duy Khang
              wrote on last edited by
              #16

              okay, let me try it!

              1 Reply Last reply
              0
              • D Duy Khang

                Sorry for my English. i'm using Qt5

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #17

                @Duy-Khang
                Can we be clear whether it is specifically because you use QSqlQueryModel that you are seeing slow behaviour?

                What is the timing if you just use:

                query = new QSqlQuery("SELECT * FROM Lecturer_DATABASE");
                

                ?
                And what about:

                int count = 0;
                query = new QSqlQuery("SELECT * FROM Lecturer_DATABASE");
                while (query.next()) 
                    qDebug() << ++count;
                
                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  Duy Khang
                  wrote on last edited by
                  #18

                  it's also takes about 10s to execute

                  JonBJ 1 Reply Last reply
                  0
                  • D Duy Khang

                    it's also takes about 10s to execute

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #19

                    @Duy-Khang
                    Which one takes 10 seconds? The 1-liner, the 4-liner, both?

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      Duy Khang
                      wrote on last edited by
                      #20

                      The 1-liner

                      JonBJ 1 Reply Last reply
                      0
                      • D Duy Khang

                        The 1-liner

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by
                        #21

                        @Duy-Khang
                        OK, so finally how long does this take:

                        query = new QSqlQuery("SELECT 'Hello'");
                        

                        Assuming you say 10 seconds, you must have something pretty odd going on with your connection/driver....

                        1 Reply Last reply
                        1
                        • D Offline
                          D Offline
                          Duy Khang
                          wrote on last edited by
                          #22

                          this is my video to show my problem. Plz help me !

                          https://drive.google.com/file/d/12_C6PmJRdoeVUsmoyumu7B6TaHL9k8mJ/view?usp=sharing

                          JonBJ 1 Reply Last reply
                          0
                          • D Duy Khang

                            this is my video to show my problem. Plz help me !

                            https://drive.google.com/file/d/12_C6PmJRdoeVUsmoyumu7B6TaHL9k8mJ/view?usp=sharing

                            JonBJ Offline
                            JonBJ Offline
                            JonB
                            wrote on last edited by
                            #23

                            @Duy-Khang
                            How does the video clarify anything?
                            Do you think we do not understand what you have asked so far?
                            How would you like someone to help you when we don't know why it doesn't work for you?
                            Best of luck....

                            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