Unsolved How can i retrieve a qtableview from stored procedure?
-
I created a stored procedure:
//your code hereCREATE PROCEDURE dbo.TableView AS SELECT * FROM table GO
When i call this sp on frontend what code i need to write to retrieve a qtableview?
-
2 things:
- A table view can't hold data, it needs a model: http://doc.qt.io/qt-5/model-view-programming.html
- A stored procedure is likely a forward only query so you cannot use QSqlQueryModel out of the box
You'll need to run the query manually and add the results into a model (QStandardItemModel?).
To see how to prepare a query see the stored procedure section of http://doc.qt.io/qt-5/qsqlquery.html#approaches-to-binding-valueshere is some (horrible) code in which I download data from a stored procedure and populate a tree model with it, I hope it helps