Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 11th, 2003, 11:00 AM
Registered User
 
Join Date: Aug 2003
Location: , , .
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.

Reply With Quote
  #2 (permalink)  
Old August 12th, 2003, 07:28 AM
Authorized User
 
Join Date: Aug 2003
Location: Cary, NC, USA.
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);
}

Reply With Quote
  #3 (permalink)  
Old August 12th, 2003, 08:04 AM
Registered User
 
Join Date: Aug 2003
Location: , , .
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

Reply With Quote
  #4 (permalink)  
Old August 12th, 2003, 08:40 AM
Authorized User
 
Join Date: Aug 2003
Location: Cary, NC, USA.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #5 (permalink)  
Old August 12th, 2003, 09:39 AM
Registered User
 
Join Date: Aug 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Has anybody some other Ideas?

Reply With Quote
  #6 (permalink)  
Old August 12th, 2003, 10:53 AM
Registered User
 
Join Date: Aug 2003
Location: , , .
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.



Reply With Quote
  #7 (permalink)  
Old October 7th, 2003, 06:25 AM
Registered User
 
Join Date: Oct 2003
Location: Sibiu, Sibiu, Romania.
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 !

Reply With Quote
  #8 (permalink)  
Old March 27th, 2006, 02:00 AM
Registered User
 
Join Date: Aug 2005
Location: NOIDA, up, India.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:26 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.