ODBC and multithreading

I am attempting to use a single CDatabase object across two threads.  I have two different CRecordSet objects that are instantiated on the stack of each thread.  The thread that hits the CRecordSet::Open command first is fine.  The second thread throws a CDBException with the message:
"Connection is busy with results for another hstmt".  The message appears to come from the ODBC driver itself.  (SQL Server)  I DO NOT wish to instantiate multiple CDatabase objects for each thread.  How do I get around this?
mozackAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
erick1217Connect With a Mentor Commented:
U need to use the same "CDatabase" object pointer in each thread and then synchronise them with a "CMutex" object or with "CreateEvent" and "WaitForSingleObject".
0
 
jkrCommented:
You have to synchronize _each_ ODBC call for every thread...
0
All Courses

From novice to tech pro — start learning today.