Wrox Programmer Forums
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 11th, 2003, 11:00 AM
Registered User
 
Join Date: Aug 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default ADO DB problem.

Hi,

I'm trying to create an extension dll that references a database via ADO, using VC 6(SP 5). The problem comes when the application is exited and it prints the following error:
'Unhandled exception in <application> (MSDART.DLL) 0xC0000005: Access Violation' This happened two times. Once when i try to release 'Connection' or 'Recordet', second after my dll's db's class destructor, if i comment Releasing.

I was trying with three Mdacs. 2.7,2.7SP1, and 2.8. with 2 OSs. 2k(SP4) and XP(SP1)
but none of them resolved my problem.

I'll be glad to see any ideas and pointers.

Best Regards:
KalliMan.

 
Old August 12th, 2003, 07:28 AM
Authorized User
 
Join Date: Aug 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you tried to catch any exceptions to make sure the database is successfully opened? Have you tried using ODBC instead of ADO?

try
{
  ...
}
catch(CDBException* e)
{
    AfxMessageBox(e->m_strError, 48);
    e->Delete();
    exit(1);
}
catch(...) // all other errors
{
        AfxMessageBox("An error occured when attempting to connect to the database.", 48);
        exit(1);
}

 
Old August 12th, 2003, 08:04 AM
Registered User
 
Join Date: Aug 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Of course! i'm sure that all excetions were caught.
I don't want ODBC.
thanks:) have u any other ideas?
KalliMan

 
Old August 12th, 2003, 08:40 AM
Authorized User
 
Join Date: Aug 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't use ADO so I do not know.
-Andy

 
Old August 12th, 2003, 09:39 AM
Registered User
 
Join Date: Aug 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Has anybody some other Ideas?

 
Old August 12th, 2003, 10:53 AM
Registered User
 
Join Date: Aug 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I thing, i found my solution.
Im my case the problem was, that I'm Using A Global DBManager's classes Variable,
from DLL which Load my DB DLL. Immediatly when I make it member in each class where used,
the problem DISAPPEAR,
Both DLL, are "implicted Linked"(i.e. export classes with (__declspec(dllimport))).
Strange, isn't it?

KalliMan.



 
Old October 7th, 2003, 06:25 AM
Registered User
 
Join Date: Oct 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi KalliMan2 ! First sorry for my English.

I have met same problem (exception from msdart.dll)!
Please tell me detailed how you solved it.

I try to explain situation :
I made an DLL and I created a few functions:

At top of file source (cpp) I declarated :

#import "c:\Program Files\Common Files\System\ADO\msado15.dll" no_namespace rename("EOF", "EndOfFile")
_RecordsetPtr pRS;

pRS is visible in all file .

An example for function's declaration :

void _declspec (dllexport) Func1(args)

In an function I open a table using pRS.
I'm assure to catch any exception and close pRS.

When I exit from aplication , I see following error:

'Unhandled exception in <application> (MSDART.DLL)

Thank you in advance !

 
Old March 27th, 2006, 02:00 AM
Registered User
 
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
cant connect to DB using ASP and ADO paulmcn MySQL 2 February 6th, 2006 07:09 AM
ADO,DAO,ADODB,DB.... ToSupremacy Access 5 February 1st, 2005 01:09 AM
Can ADO/OLE DB Run from a CD? Hugh Smith VB How-To 1 January 25th, 2005 10:35 AM
backup access db (ado) jolzy Pro VB Databases 1 November 2nd, 2004 04:41 AM
Disconnect ADO Conn from Access DB myedu2k4 Pro VB Databases 2 May 27th, 2004 01:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.