Don't concatenate values onto an QSL query, use QSqlQuery::bindValue() instead.
A coupe of things for this:
- no need to create the model every time, just create it once and keep it in a member variable.
- you then only need to set it once one the table as well
- Don't create the query on the heap, you are leaking it
- in fact you can just pass the SQL string to the model
- see if you have the data you expect inside the model, e.g
or create a QTableView (without parent it becomes a separte window) and let it have the same modelQt Code:
qDebug() << model->index(0, 0).data(Qt::DisplayRole);To copy to clipboard, switch view to plain text mode
Cheers,
_
Bookmarks