Microsoft KB Archive/321329

= How To Find Jet Database .mdb File Format Version =

Article ID: 321329

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft ActiveX Data Objects 2.7

-



This article was previously published under Q321329



SUMMARY
When you try to convert or compact your database, it is helpful to know the version specific details of the Jet Database. This article includes code that finds the version of the Jet Database that your application is connected to.



MORE INFORMATION
The following code finds the Jet Database version using Visual C++ and ADO. To find the Jet Database version, follow these steps:   Copy the following code, and save it as FindJetVersion.cpp: using namespace ado20;
 * 1) import &quot;c:\program files\common files\system\ado\msado15.dll&quot; rename_namespace(&quot;ado20&quot;) rename(&quot;EOF&quot;, &quot;ADOEOF&quot;)

struct HandleCOM {   HandleCOM  { ::CoInitialize(NULL); } ~HandleCOM { ::CoUninitialize;  } } _HandleCOM_;

void main {   _bstr_t         bstrEmpty(L&quot;&quot;); _ConnectionPtr cnDatabase(__uuidof(Connection)); _bstr_t strConn( L&quot;&quot;); strConn = &quot;Provider=Microsoft.Jet.OLEDB.4.0; Data Source=F:\\CustomerCode\\_DAO\\DatabaseConversionIssue\\testdbs\\test.mdb&quot;; HRESULT hr = cnDatabase->Open(strConn, bstrEmpty,bstrEmpty,-1);

if (cnDatabase->Properties->Item[&quot;Jet OLEDB:Engine Type&quot;]->Value == (_variant_t)(long)5) MessageBox(NULL,&quot;It's Jet 4.0 Format Database&quot;,&quot;Jet File Format version&quot;,MB_OK); else if      (cnDatabase->Properties->Item[&quot;Jet OLEDB:Engine Type&quot;]->Value == (_variant_t)(long)4) MessageBox(NULL,&quot;It's lower than Jet 4.0 format Database&quot;,&quot;Jet File Format version&quot;,MB_OK); else MessageBox(NULL,&quot;Couldn't determine the version of Access File&quot;,&quot;Jet file version&quot;,MB_OK);

} NOTE: Depending on your system, you may have to change the paths for #import and file location.

 On the File menu in Visual C++, click Open to open FindJetVersion.cpp that you just saved. On the Build menu, click Build to build FindJetVersion.exe.  A dialog box appears with the following message: This build command requires an active project workspace. Would you like to create a default project workspace? Click Yes to build FindJetVersion.exe. 

