Microsoft KB Archive/162958

= FIX: Format of the Password Parameter for CompactDatabase =

Article ID: 162958

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 4.0 Standard Edition

 Microsoft Visual C++ 4.1 Subscription

 Microsoft Visual C++ 4.2 Enterprise Edition

 Microsoft Visual C++ 4.2 Professional Edition</li></ul>

 Microsoft Visual C++ 5.0 Enterprise Edition</li></ul>

 Microsoft Visual C++ 5.0 Professional Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q162958

<div class="summary_section">

SUMMARY
The documentation for the CDaoWorkspace::CompactDatabase function does not specify the format of the password parameter. The password must be in the following format: ";PWD=password". If the password is not in the correct format, you may see the following error:

Can't find installable ISAM

<div class="moreinformation_section">

MORE INFORMATION
The documentation for the CDaoWorkspace::CompactDatabase function gives the following information about compacting a password-protected database: <pre class="fixed_text">static void PASCAL CompactDatabase( LPCTSTR lpszSrcName, LPCTSTR   lpszDestName, LPCTSTR lpszLocale, int nOptions, LPCTSTR lpszPassword );

Parameters lpszPassword  A password, used when you want to compact a               password-protected database. Note that if you use the version of CompactDatabase that takes a password, you must supply all parameters. There is no information about the format of the password parameter. However, the documentation for the DBEngine.CompactDatabase function has the following information: <pre class="fixed_text">Syntax DBEngine.CompactDatabase olddb, newdb [, locale [, options [, ;pwd=password]]]

Part          Description password      An optional string argument containing a password, if the database is password protected. The string ";pwd=" must precede the actual password.

Sample Code
/* Compile options needed: none */

/* The following code will compress the database C:\DB1.MDB, which has * a password of "MyPassword" */

try {       CDaoWorkspace::CompactDatabase( _T( "C:\\DB1.MDB" ),            _T( "C:\\DB2.MDB" ), dbLangGeneral, dbVersion30,            _T( ";PWD=MyPassword" ) ); }   catch( CDaoException* e ) {       AfxMessageBox( e->m_pErrorInfo->m_strDescription ); e->Delete; }

<div class="status_section">

STATUS
This problem was corrected in the documentation for Visual C++, version 6.0.

<div class="references_section">