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. CDaoDatabase closing problem

CDaoDatabase closing problem

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasehelpquestion
2 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.
  • P Offline
    P Offline
    Paul Ebert
    wrote on last edited by
    #1

    For some reason, AfxDaoTerm is not being called when I close my database. The database is created using new equated to a member pointer (of type CDaoDatabase*) of my document. When I destruct the document I close the database and then delete it. I then delete some other objects and, then, the destructor terminates. At that point I get an assertion on line 42 of Daocore.cpp which, according to the comment, indicates that AfxDaoTerm is not being called. If I place an explicit call to AfxDaoTerm after deleting the database pointer, I do not get the assertion and my application exits without apparent problem. Any hints as to what might be going on? Thanks.

    T 1 Reply Last reply
    0
    • P Paul Ebert

      For some reason, AfxDaoTerm is not being called when I close my database. The database is created using new equated to a member pointer (of type CDaoDatabase*) of my document. When I destruct the document I close the database and then delete it. I then delete some other objects and, then, the destructor terminates. At that point I get an assertion on line 42 of Daocore.cpp which, according to the comment, indicates that AfxDaoTerm is not being called. If I place an explicit call to AfxDaoTerm after deleting the database pointer, I do not get the assertion and my application exits without apparent problem. Any hints as to what might be going on? Thanks.

      T Offline
      T Offline
      Tim Deveaux
      wrote on last edited by
      #2

      There are a few articles in the MSDN KB that talk about how MFC calls AfxDaoTerm from the ExitInstance of CWinApp, and how this can create problems with DAO objects declared at global scope or in DLLs etc. Seaching for afxdaoTerm will bring up about 4 or 5 articles that are almost-but-not-quite your scenario. Calling AfxDaoTerm directly is indeed one of the solutions mentioned. HTH

      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