MS Sql Stored Procedure with ODBC



  • For some things I have to do with my SQL table I was just recommended to use a stored procedure. I am not exactly sure how to call it in though. I believe I need to use a query and I understand with ODBC I need to use setForwardOnly and set it to true so something like:
    @
    QSqlQuery query;
    query.setForwardOnly(true);
    query.exec("{Calll storedProc}");
    @

    But I have been using a QTableModel because I didn't know that I was going to need this Stored Procedure. So my whole program has a lot of functions that use the tableModel and some of its functions and some of the more important things are things like a checkbox in the main Window that is set us that if it is checked the tableModel's filter is set to only show active records and if not checked show all records. The other thing is a search bar that is connected to a QSortFilterProxyModel who's sourceModel is the TableModel. And if I can't still use this I will have to completely redo a large chunk of my program which has to be done in a few days.

    So my main question is does anyone know a way I can keep this? Could I do something like a custom subclass of QTableModel that makes setQuery public?

    any help would be greatly appreciated! Thank you!



  • Never mind. I think I figured out another way to do what I need without a stored procedure.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.