PDA

View Full Version : How to get data from mysql ?



BuranereLoo
3rd September 2015, 11:46
Hi guys
I have a question. How to get data from mysql and how this data write to QTableWidget ?
Thanks*

anda_skoa
3rd September 2015, 11:59
For example with QSqlQueryModel.

Cheers,
_

BuranereLoo
3rd September 2015, 12:03
Can you give an example?

anda_skoa
3rd September 2015, 14:23
First you create a database connection
http://doc.qt.io/qt-5/qsqldatabase.html#details

Then you use this to either create a QSqlQuery object and pass that to the model, or you pass the query and the connection to the model.
The model can be set on a QTableView before that.

Cheers,
_