Acces Violation with oledb CoUninitialize() instruction
-
Hi, I use Visual C++ 6.0 SP 4 , SQL Server and oledb I create a class to connect to my database. In my constructor i initialize com library like this : CoInitialize(NULL); In my destructor i release com library like this : CoUninitialize(); If i use this class to execute for exemple an sql query ( store procedure), my functions open, execute, close,... work. But if i close my application ( OnOK ) , two seconds later i obtain the following acces violation message : EXCEPTION(c0000005 acces,@40f919) EBP184f0b8 EIP40f919) ASM 45 fc 8b 08 8b 01 52 ff 50 08 8b e5 5d c3 cc cc cc cc cc cc EAX:184f618 EBX:dc0110 ECX:383439 EDX:383439 ESI:dc0064 EDI:184f664 ESP:184f0b4 The suspect function is _Release() throw() which is in a Visual C++ include file ( in Include\COMIP.H ) // Releases only if the interface is not null. // The interface is not set to NULL. void _Release() throw() { if (m_pInterface != NULL) { m_pInterface->Release(); } } But if i comment out CoUninitialize() instruction, my code work without acces violation. Can anybody help me? Best regards, Cheickna :confused: