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. Database & SysAdmin
  3. Database
  4. new CDaoRecordset in a DLL Problem

new CDaoRecordset in a DLL Problem

Scheduled Pinned Locked Moved Database
c++databasecomhelpquestion
1 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.
  • C Offline
    C Offline
    Crercio O Silva
    wrote on last edited by
    #1

    Hi, I have created a DLL which access the DAO objects (specially MSAccess databases). In the code I create the CDaoRecordset with the new operator, like this: CDaoRecordset * CDaoClass::Query(CString query) { CDaoRecordset * pNewRecord = new CDaoRecordset(&m_pDatabase); pNewRecord->Open(AFX_DAO_USE_DEFAULT_TYPE, query, 0); return pNewRecord; } CDaoClass::CloseRecordSet(CDaoRecordset * pRecord) { pRecord->Close(); delete pRecord; } This works just as it should if the classes are in the main application, but I'm getting an exception when in DLL the CDaoRecordset::Open() method is executed. The other DAO methods are working fine, so I can list the tables, change them, create indexes, relationships, etc. But I can't execute queries that returns data. When debugging the application I found out that there is an exception in DAOCORE.CPP line 4855, shown bellow: void CDaoRecordset::BuildSelectList() { ASSERT_VALID(this); ASSERT(m_nFields > 0); // This line will assert since m_nFields is 0 m_strSQL += _afxSelect2; CDaoFieldExchange fx(CDaoFieldExchange::AddToSelectList, this); DoFieldExchange(&fx); } Does anyone have any clues about it? Thanks in advance. Crercio O. Silva / DBTools Crercio O. Silva / DBTools Development http://www.dbtools.com.br

    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