DAO within OCX / OLE Control
developers@softech-telecom.com
Thursday, February 20, 1997
Environment: VC++ 4.1, Win95
I am having a problem with using DAO MFC classes in my OCX. I have
read the Microsoft Knowledge Base article Q143084 which says that
there was a problem but that it has been fixed in 4.1. There is also
another article giving guidelines about making sure all DAO objects
are closed before calling AfxDaoTerm. I have isolated the problem in
an easy-to-reproduce project created by the OCX Wizard accepting all
of the defaults. The project was called DAOTest here are the only
modifications I made to the code:
int CDAOTestApp::ExitInstance()
{
AfxDaoTerm();
return COleControlModule::ExitInstance();
}
The wizard was used to add a single method which was modified to:
void CDAOTestCtrl::DoIt()
{
CDaoDatabase* pDb = NULL;
TRY
{
pDb = new CDaoDatabase;
pDb->Open("DAOTest.MDB");
pDb->Close();
}
END_TRY
delete pDb;
}
The program ASSERTs in daocore.cpp line 36 on exiting.
Regards,
PJ Naughter.
Kevin Tarn -- kevin@pln.com.tw
Friday, February 21, 1997
Please try to move AfxDaoTerm to CDAOTestCtrl::~ CDAOTestCtrl().
Kevin Tarn
-----Original Message-----
From: developers@softech-telecom.com [SMTP:developers@softech-telecom.com]
Sent: Thursday, February 20, 1997 11:39 PM
To: mfc-l@netcom.com
Subject: DAO within OCX / OLE Control
Environment: VC++ 4.1, Win95
I am having a problem with using DAO MFC classes in my OCX. I have
read the Microsoft Knowledge Base article Q143084 which says that
there was a problem but that it has been fixed in 4.1. There is also
another article giving guidelines about making sure all DAO objects
are closed before calling AfxDaoTerm. I have isolated the problem in
an easy-to-reproduce project created by the OCX Wizard accepting all
of the defaults. The project was called DAOTest here are the only
modifications I made to the code:
int CDAOTestApp::ExitInstance()
{
AfxDaoTerm();
return COleControlModule::ExitInstance();
}
The wizard was used to add a single method which was modified to:
void CDAOTestCtrl::DoIt()
{
CDaoDatabase* pDb = NULL;
TRY
{
pDb = new CDaoDatabase;
pDb->Open("DAOTest.MDB");
pDb->Close();
}
END_TRY
delete pDb;
}
The program ASSERTs in daocore.cpp line 36 on exiting.
Regards,
PJ Naughter.
Dan Kirby -- dkirby@accessone.com
Monday, February 24, 1997
Check out article Q152315. You must call AfxDaoTerm() before
ExitInstance().
--dan
> -----Original Message-----
> From: developers@softech-telecom.com
[SMTP:developers@softech-telecom.com]
> Sent: Thursday, February 20, 1997 11:39 PM
> To: mfc-l@netcom.com
> Subject: DAO within OCX / OLE Control
>
> Environment: VC++ 4.1, Win95
>
> I am having a problem with using DAO MFC classes in my OCX. I have
> read the Microsoft Knowledge Base article Q143084 which says that
> there was a problem but that it has been fixed in 4.1. There is also
> another article giving guidelines about making sure all DAO objects
> are closed before calling AfxDaoTerm. I have isolated the problem in
> an easy-to-reproduce project created by the OCX Wizard accepting all
> of the defaults. The project was called DAOTest here are the only
> modifications I made to the code:
>
> int CDAOTestApp::ExitInstance()
> {
> AfxDaoTerm();
> return COleControlModule::ExitInstance();
> }
>
> The wizard was used to add a single method which was modified to:
>
> void CDAOTestCtrl::DoIt()
> {
> CDaoDatabase* pDb = NULL;
>
> TRY
> {
> pDb = new CDaoDatabase;
> pDb->Open("DAOTest.MDB");
> pDb->Close();
> }
> END_TRY
>
> delete pDb;
> }
>
> The program ASSERTs in daocore.cpp line 36 on exiting.
>
> Regards,
> PJ Naughter.
Become an MFC-L member
| Вернуться в корень Архива
|