Acess Violation in MSDART.dll 0xC0000005
Hello All Members,
I have some problem with VC++ code. I have created a DLL having a database class having connection pointer and recordset pointer. And I
have created Databse class (using ODBC) object into dllApp Class to make it use like global object.
But when i call my dll and debug my dll i got exception at database class destructor (while exiting fron DLL because this destructor is called
during the dll exitpoint).
//Databse.cpp
Datbase::~Database
{
newDSNptr=NULL; //_ConnectionPtr
newRECptr=NULL; //_RecordsetPtr ====>>>> Throws exception
::CoUninitialize();
}
Datbase::Database
{
::CoInitialize();
newDSNptr=NULL; //_ConnectionPtr
newRECptr=NULL; //_RecordsetPtr
try
{
newDSNptr.CreateInstance((__uuidof(Connection)));
newRECptr.CreateInstance((__uuidof(Recordset)));
newDSNptr->Open(L"Provider=MSDASQL.1;Persist Security Info=False;DSN=NEW_DB_DSN;",L"",L"",0);
}
catch(_com_error &e)
{
AfxMessageBox(L"Error in New DataBse Connection\n" + e.Description());
writeToFile(_T("CDatabase: ERROR: Error in New DataBse Connection:"));
}
}
And in header file i have written like this
//Databse.h
#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF", "EndOfFile")
"First-chance exception in App.exe: 0xC0000005: Access Violation."
"First-chance exception in App.exe (MSDART.DLL): 0xC0000005: Access Violation."
I have used all the try catch block for Database member function operation to avoid any unhandelled exception. If anybody can help me i will
be very thankful to that people. i am in serious problem plz. help me as soon as possible.
Thanks in advance.
Ambrish
Ambrish
|