Solved

Problem with multithread access.mdb

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sumNumber challenge 16 140
sum13 challenge 24 134
sum67 challenge 35 116
sumHeights2  challenge 7 131
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

749 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