Solved

Problem with multithread access.mdb

Posted on 2003-10-27
4
350 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
  • 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

759 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now