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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to convert a _variant_t to recordset in vc++?

how to convert a _variant_t to recordset in vc++?

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
3 Posts 2 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hello All, How to convert a variant, which is returned by vb dll that actually contains a adodb.recordset, to recordet in vc++? I casted it to IDispatch and to Recordset. But always I'm not getting records. If I used recordcount, it's returning only -1. Advance thanks for ur reply. regards, ramesh :confused: :confused:

    C 1 Reply Last reply
    0
    • L Lost User

      Hello All, How to convert a variant, which is returned by vb dll that actually contains a adodb.recordset, to recordet in vc++? I casted it to IDispatch and to Recordset. But always I'm not getting records. If I used recordcount, it's returning only -1. Advance thanks for ur reply. regards, ramesh :confused: :confused:

      C Offline
      C Offline
      chenzhu
      wrote on last edited by
      #2

      You can convert the IDispatch to a _RecordsetPtr. //mycontrol.h _RecordsetPtr m_pRS; //mycontrol.cpp STDMETHODIMP CMeCTable::put_DataSource(IDispatch *newVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) if (m_pRS == NULL) m_pRS = NULL; HRESULT hr = newVal->QueryInterface(__uuidof(_RecordsetPtr), (void**)&m_pRS); if FAILED(hr) { return E_FAIL; } }

      L 1 Reply Last reply
      0
      • C chenzhu

        You can convert the IDispatch to a _RecordsetPtr. //mycontrol.h _RecordsetPtr m_pRS; //mycontrol.cpp STDMETHODIMP CMeCTable::put_DataSource(IDispatch *newVal) { AFX_MANAGE_STATE(AfxGetStaticModuleState()) if (m_pRS == NULL) m_pRS = NULL; HRESULT hr = newVal->QueryInterface(__uuidof(_RecordsetPtr), (void**)&m_pRS); if FAILED(hr) { return E_FAIL; } }

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Hi chenzhu, Thank you very much for your suggestion. Even after using the QueryInterface also I didn't get the exact value from the GetRecordCount function. I got one reply such that it is because of the cursor type. Now, I can traverse thru recordset by using Move functions. The only thing I couldn't able to get the records count and fields count. If any more solutions, let me know. Thanking you, regards, Ramesh :eek: :rolleyes:

        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