Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database Compacting Problem

Status
Not open for further replies.

PalaniappaBabu

Programmer
May 23, 2001
10
US
I am trying to compact a MS-Access database using the follwing piece of code which is in Visual C++/JRO :

try
{
CoInitialize(NULL);

IJetEnginePtr jet(__uuidof(JetEngine));
jet->CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=nSamp.mdb","Provider=Microsoft.Jet.OLEDB.4.0;Data Source=nSampAc.mdb;Jet OLEDB:Engine Type=4");

CoUninitialize();

}
catch(_com_error &e)
{
::MessageBox(NULL, (LPCTSTR)e.Description( ), "", MB_OK) ;
}


The two database are created using MS-Access 2000. but i am getting the following exception :

"Cannot perform this operation; feature in this version are not available in database with older formats."

Can anybody help me??
 
Yeah....

The problem is with Jet OLEDB Engine Type.

The value must be 5 instead of 4 since i am using
Microsoft.Jet.OLEDB.4.0 engine.

The CompactDatabase statement must be like

jet->CompactDatabase("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=nSamp.mdb","Provider=Microsoft.Jet.OLEDB.4.0;Data Source=nSampAc.mdb;Jet OLEDB:Engine Type=5");

Thanks....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top