Too long to load data from Sql Server
-
@Duy-Khang Please provide more information:
- Is the SQL server running on another machine?
- How long does it take if you execute same query directly using command line SQL client?
- How many rows do you have in that table?
-
@Duy-Khang Please provide more information:
- Is the SQL server running on another machine?
- How long does it take if you execute same query directly using command line SQL client?
- How many rows do you have in that table?
-
@Duy-Khang Please provide more information:
- Is the SQL server running on another machine?
- How long does it take if you execute same query directly using command line SQL client?
- How many rows do you have in that table?
-
@Duy-Khang said in Too long to load data from Sql Server:
do u have facebook account ?
i'll send you video to watch.I consider such posts to be spam...
-
@Duy-Khang said in Too long to load data from Sql Server:
do u have facebook account ?
i'll send you video to watch.I consider such posts to be spam...
-
@Duy-Khang said in Too long to load data from Sql Server:
i'm very sorry about that
OK, no problem.
Try to do it like shown here: https://doc.qt.io/qt-5/qsqlquerymodel.html (without QSqlQuery)
modal = new QSqlQueryModel(); modal->setQuery("SELECT name, salary FROM employee"); ui->tableView->setModel(modal);
Does it make a difference?
-
@Duy-Khang said in Too long to load data from Sql Server:
i'm very sorry about that
OK, no problem.
Try to do it like shown here: https://doc.qt.io/qt-5/qsqlquerymodel.html (without QSqlQuery)
modal = new QSqlQueryModel(); modal->setQuery("SELECT name, salary FROM employee"); ui->tableView->setModel(modal);
Does it make a difference?
-
Hi,
Which database plugin are you using ?
By the way, there's no need to allocate QSqlQuery on the heap. -
And how do you know that it's because of the query model?
What Qt version do you use? -
@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.
-
@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.
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). -
@Duy-Khang
Can we be clear whether it is specifically because you useQSqlQueryModel
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;
-
@Duy-Khang
Which one takes 10 seconds? The 1-liner, the 4-liner, both?