Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. MS Sql Stored Procedure with ODBC
QtWS25 Last Chance

MS Sql Stored Procedure with ODBC

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.0k Views
  • 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 Offline
    C Offline
    confused
    wrote on last edited by
    #1

    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
    0
    • C Offline
      C Offline
      confused
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved