Solved

Problem with multithread access.mdb

Posted on 2003-10-27
4
368 Views
Last Modified: 2013-11-20
Hi,
   i have three threads each with a CDaoworkspace, CDaoRecordSet objects. The dao's looks at the same database. I create three workspaces i append them and make setisolationODBC=true for multi connection. I do not make begintransaction and committransaction because i have problem with the requery and addnew. After continously 10000 transactions i have unhandled exception in dao.dll. Any ideas?
0
Comment
Question by:ttsenis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
migel earned 50 total points
ID: 9626026
Hi!
did you read this article in the MSDN
"PRB: Thread Safety for DAO/Jet"
PSS ID Number: 169395
or Q169395
?
0
 
LVL 4

Expert Comment

by:inox
ID: 9626610

Hi,
DAO is not threadsafe.

Syncronize with mainthread or use ADO instead.

P.S:
To all who think it works:
I know it (seems to) work, but
DAO is not threadsafe.
I know it (seems to) work 10, 100, 10000 times , but
DAO is not threadsafe.
I know Jet Engine ist threadsfe, but
DAO is not threadsafe.
and if you want to make CDAO objects threadsafe by marshalling, forget it

0
 

Author Comment

by:ttsenis
ID: 9642318
I did put the ADO com and i almost found everything ok, except i have problem with the AddNew and the UpDate. They introduce a VARIANT input for FIELDS and the VALUES. Any idea how the input variant inputs should include the fileds and the values (just the name or the IDispatch). Any example for MFC and the ADO com?

   Regards,
     Teo.
0
 
LVL 4

Expert Comment

by:inox
ID: 9643425
Hi Teo,
you must specify specific cursor- and locktype to modify or append, maybe that's the problem i.e:

_RecordsetPtr g_pRs = NULL;
_variant_t v;
long l;

TESTHR(g_pRs->Open ("Table1",strCnn,adOpenKeyset,adLockOptimistic,adCmdTableDirect));
TESTHR(g_pRs->Seek(_variant_t(1L),adSeekFirstEQ));
v=g_pRs->Fields->Item["ID"]->Value;
l=v.lVal;

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question