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. COM
  4. _RecordsetPtr Detach / Debug Exception

_RecordsetPtr Detach / Debug Exception

Scheduled Pinned Locked Moved COM
c++debuggingannouncementcom
5 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.
  • E Offline
    E Offline
    Ecator
    wrote on last edited by
    #1

    Hi! I'm new to posting here, but I wanted to start out with an annoying feature that was bugging me. I get to do a lot of the weird programming assignments..... I've got a ATL/COM Service that has one Simple ATL Apartment object. It takes a flat file record and converts it into a one row recordset with appropriate columns. It has a method to pass a detached recordset back and forth, such as this: [id(2), helpstring("method ReadRecord")] HRESULT ReadRecord([in, out] VARIANT *iRetVal, [out, retval] IUnknown **ppRecordset); STDMETHODIMP CGenericObj::ReadRecord(VARIANT *iRetVal, IUnknown **ppRecordset) It works perfectly fine, except when you get into the debugger, and only once you get out of the raw_ReadRecord. First-chance exception in Generic.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception. But, everything works fine, even in release mode. When I don't detach the recordset, the message does not surface. When the object is passed back in through: STDMETHODIMP CGenericObj::WriteRecord(IUnknown *pRecordset, VARIANT *iRetVal) It does the same thing. The code to generate it: _RecordsetPtr m_pRs; m_pRs.CreateInstance(__uuidof(Recordset)); (read field loop) m_pRs->Fields->Append(_T((LPCSTR)pField.sExternalName), lEnum, lFieldSize, adFldIsNullable); (read field loop end) _variant_t vNull(DISP_E_PARAMNOTFOUND,VT_ERROR); m_pRs->Open(vNull,vNull,adOpenForwardOnly, adLockOptimistic, adCmdUnknown); m_pRs->AddNew(); (read file field loop) m_pRs->Update(); *ppRs = m_pRs.Detach(); Just curious what you coders think....

    P 1 Reply Last reply
    0
    • E Ecator

      Hi! I'm new to posting here, but I wanted to start out with an annoying feature that was bugging me. I get to do a lot of the weird programming assignments..... I've got a ATL/COM Service that has one Simple ATL Apartment object. It takes a flat file record and converts it into a one row recordset with appropriate columns. It has a method to pass a detached recordset back and forth, such as this: [id(2), helpstring("method ReadRecord")] HRESULT ReadRecord([in, out] VARIANT *iRetVal, [out, retval] IUnknown **ppRecordset); STDMETHODIMP CGenericObj::ReadRecord(VARIANT *iRetVal, IUnknown **ppRecordset) It works perfectly fine, except when you get into the debugger, and only once you get out of the raw_ReadRecord. First-chance exception in Generic.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception. But, everything works fine, even in release mode. When I don't detach the recordset, the message does not surface. When the object is passed back in through: STDMETHODIMP CGenericObj::WriteRecord(IUnknown *pRecordset, VARIANT *iRetVal) It does the same thing. The code to generate it: _RecordsetPtr m_pRs; m_pRs.CreateInstance(__uuidof(Recordset)); (read field loop) m_pRs->Fields->Append(_T((LPCSTR)pField.sExternalName), lEnum, lFieldSize, adFldIsNullable); (read field loop end) _variant_t vNull(DISP_E_PARAMNOTFOUND,VT_ERROR); m_pRs->Open(vNull,vNull,adOpenForwardOnly, adLockOptimistic, adCmdUnknown); m_pRs->AddNew(); (read file field loop) m_pRs->Update(); *ppRs = m_pRs.Detach(); Just curious what you coders think....

      P Offline
      P Offline
      pba_
      wrote on last edited by
      #2

      What's the exception code ?

      E 1 Reply Last reply
      0
      • P pba_

        What's the exception code ?

        E Offline
        E Offline
        Ecator
        wrote on last edited by
        #3

        Heh, as it reads in the question itself (First Chance exception....), only unless you turn off automatic handling of that exception, it just does a print to the debug window.... Ah well...perhaps I didn't build the object right...

        P 1 Reply Last reply
        0
        • E Ecator

          Heh, as it reads in the question itself (First Chance exception....), only unless you turn off automatic handling of that exception, it just does a print to the debug window.... Ah well...perhaps I didn't build the object right...

          P Offline
          P Offline
          pba_
          wrote on last edited by
          #4

          "First chance exception in ... : Microsoft C++ Exception" means a C++ exception is thrown but not catch. Try to wrap up your method call in a try / catch statement, and catch a _com_error exception. Take a look at the error code.

          E 1 Reply Last reply
          0
          • P pba_

            "First chance exception in ... : Microsoft C++ Exception" means a C++ exception is thrown but not catch. Try to wrap up your method call in a try / catch statement, and catch a _com_error exception. Take a look at the error code.

            E Offline
            E Offline
            Ecator
            wrote on last edited by
            #5

            Its just an access violation in Kernel32 once the raw_ function loses scope, which means it could be anything, so I think I'll just drop it. Ah well, I've got to get back to DOS programming now....

            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