Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    MS Sql Stored Procedure with ODBC

    General and Desktop
    1
    2
    1876
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      confused last edited by

      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!

      1 Reply Last reply Reply Quote 0
      • C
        confused last edited by

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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post