Hi all. I have a Regular DLL that writes and reads in a SQL Server Database using ADO; also, I have a member variable in the application class for the connection:
class CDatabaseMgrApp : public CWinApp
{
//
//...
public:
_ConnectionPtr m_pConnection;
//
//
}
BOOL CDatabaseMgrApp::InitInstance()
{
::CoInitialize(NULL);
m_pConnection.CreateInstance(__uuidof(Connection));
return CWinApp::InitInstance();
}
The DLL and the client programms work fine, the problem shows up when I close de app (EXE), it shows the message:
orgAdmin.exe - App error
The instrucción "0x793dc247" refers to memory in "0x0000048". The memory cannot "written".
In DEBUG mode, this happens in:
int CDatabaseMgrApp::ExitInstance()
{
bool bIsOpen = false;
if (m_pConnection)
bIsOpen = m_pConnection->GetState() != adStateClosed;
if (bIsOpen)
m_pConnection->Close(); //HERE IS THE PROBLEM.
m_pConnection.Release();
::CoUninitialize();
return CWinApp::ExitInstance();
}
'm_pConnection->Close()' is defined in msado15.dli:
inline HRESULT Connection15::Close ( ) {
HRESULT _hr = raw_Close(); //HERE IS THE PROBLEM.
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _hr;
}
'raw_Close()' causes the problem and it shows the message:
Unhandled exception in orgAdmin.exe (KERNEL32.DLL) 0xC00000005:Access Violation.
I am using VC6.00.
How can I solve this?. Is this a COM problem?
Thanks in advance.
William GS.
class CDatabaseMgrApp : public CWinApp
{
//
//...
public:
_ConnectionPtr m_pConnection;
//
//
}
BOOL CDatabaseMgrApp::InitInstance()
{
::CoInitialize(NULL);
m_pConnection.CreateInstance(__uuidof(Connection));
return CWinApp::InitInstance();
}
The DLL and the client programms work fine, the problem shows up when I close de app (EXE), it shows the message:
orgAdmin.exe - App error
The instrucción "0x793dc247" refers to memory in "0x0000048". The memory cannot "written".
In DEBUG mode, this happens in:
int CDatabaseMgrApp::ExitInstance()
{
bool bIsOpen = false;
if (m_pConnection)
bIsOpen = m_pConnection->GetState() != adStateClosed;
if (bIsOpen)
m_pConnection->Close(); //HERE IS THE PROBLEM.
m_pConnection.Release();
::CoUninitialize();
return CWinApp::ExitInstance();
}
'm_pConnection->Close()' is defined in msado15.dli:
inline HRESULT Connection15::Close ( ) {
HRESULT _hr = raw_Close(); //HERE IS THE PROBLEM.
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _hr;
}
'raw_Close()' causes the problem and it shows the message:
Unhandled exception in orgAdmin.exe (KERNEL32.DLL) 0xC00000005:Access Violation.
I am using VC6.00.
How can I solve this?. Is this a COM problem?
Thanks in advance.
William GS.