?
Solved

Problem with multithread access.mdb

Posted on 2003-10-27
4
Medium Priority
?
374 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 150 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month11 days, 5 hours left to enroll

770 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