CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 1999
    Posts
    8

    HELP: Worker threads and CDaoDatabase (Part 2)

    I have an application which runs lengthy database
    analysis. A UI dialog collects the analysis parameters,
    and runs the analysis after the user clicks "OK".

    The application is structured so that the actual
    analysis is performed in a worker thread. On clicking
    "OK", a worker thread is started. The worker function
    dynamically allocates a database object which contains
    (among other things) a CDaoDatabase member and several
    methods used in the analysis. After allocation, the
    the analysis routine is started, it runs to completion,
    the database object is deleted, and the worker function
    exits. At this point I should be done with the database
    entirely.

    The problem: When I close the main dialog to shut down
    application (this is in the main thread), I get an
    exception error in MFCD42D.DLL in AfxDaoTerm(). I know
    that there are thread issues with DAO, but as far as I
    can tell, I have completely encapsulated my database
    access in the worker thread.

    An ideas on what I'm doing wrong?

    Eric

  2. #2
    Join Date
    May 1999
    Posts
    17

    Re: HELP: Worker threads and CDaoDatabase (Part 2)

    There are articles which address these probs:
    KB: Q169395 and
    "DAO and the Apartment-threading Model"

    These and several more can be found in the MSDN library. (or http://msdn.microsoft.com).

    You need to build with _UNICODE defined and there are more restrictions. I gave up on DAO because of them.

    HTH,
    Peter



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured