Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. Anyone use Stored Procs return multiple results?

Anyone use Stored Procs return multiple results?

Scheduled Pinned Locked Moved ATL / WTL / STL
databasec++wpfwcfsysadmin
2 Posts 1 Posters 0 Views 1 Watching
  • 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.
  • N Offline
    N Offline
    nativespirits
    wrote on last edited by
    #1

    :confused: I have a stored procedure that returns more than one result set (mulitiple select statements). I am using ATL Server and have found an example from Microsoft called OnlineAddressBook. This example has helped me considerably with the OLEDB Consumer Template, specifically db_command and db_column. However, all though it indicates the possibility of moving thru more than one result set it doesn't give any clear example, such as syntax or whether or not binding can be manual or has to be automatic. I am sure this is a simple process but it is eluding me and I cannot find any examples or user posts anywhere on this. I have: [ db_command(L"{CALL dbo.spTranscriptGetStudents(?, ?, ?) }") ] class CGetStudents { public: // In order to fix several issues with some providers, the code below may bind // columns in a different order than reported by the provider [ db_column(1) ] LONG m_StudentNum; [ db_column(2) ] TCHAR m_LastName[DB_MAX_FIELDLEN + 1]; [ db_column(3) ] TCHAR m_FirstName[DB_MAX_FIELDLEN + 1]; [ db_param(1) ] DBTIMESTAMP m_asofdate; [ db_param(2) ] LONG m_schnum; [ db_param(3) ] LONG m_schyear; };

    N 1 Reply Last reply
    0
    • N nativespirits

      :confused: I have a stored procedure that returns more than one result set (mulitiple select statements). I am using ATL Server and have found an example from Microsoft called OnlineAddressBook. This example has helped me considerably with the OLEDB Consumer Template, specifically db_command and db_column. However, all though it indicates the possibility of moving thru more than one result set it doesn't give any clear example, such as syntax or whether or not binding can be manual or has to be automatic. I am sure this is a simple process but it is eluding me and I cannot find any examples or user posts anywhere on this. I have: [ db_command(L"{CALL dbo.spTranscriptGetStudents(?, ?, ?) }") ] class CGetStudents { public: // In order to fix several issues with some providers, the code below may bind // columns in a different order than reported by the provider [ db_column(1) ] LONG m_StudentNum; [ db_column(2) ] TCHAR m_LastName[DB_MAX_FIELDLEN + 1]; [ db_column(3) ] TCHAR m_FirstName[DB_MAX_FIELDLEN + 1]; [ db_param(1) ] DBTIMESTAMP m_asofdate; [ db_param(2) ] LONG m_schnum; [ db_param(3) ] LONG m_schyear; };

      N Offline
      N Offline
      nativespirits
      wrote on last edited by
      #2

      I think I solved this one also. At least it compiled, have to run it to test that it works. Basically bind the columns of the first result set to the db_command using db_column. Then in the receiving method check to see if you can .MoveNext record in the first result set if not use the .GetNextResult method to move to the next one. Heres the code: while (S_OK!=GetStudents.MoveFirst()) { GetStudents.GetNextResult(&numRecs, true); }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups