CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    38

    How to use CompactDatabase with non .mdb files ?

    I use DAO.
    My application creates local files which are mdb files. When I create these files, I give them another extension rather than .mdb (let's say .pol).

    I want to use CompactDatabase, but it seems that this method works only if the extension of the source and destination files is .mdb and no other one.

    When I use CompactDatabase with FileSrc.pol and FileDest.pol it tells me that it doesn't find the ISAM pilot. It shouldn't look for any ISAM pilot as my files are Microsoft Jet databases.

    Does anybody knoes how to work around the problem ?



  2. #2
    Join Date
    Jan 2001
    Location
    Pune,India
    Posts
    15

    Re: How to use CompactDatabase with non .mdb files ?

    Hi..
    I am a university student and want to use Access DB as backend in my VC++ application.
    For that I want to compact the DB(i.e. MDB file)
    to another .mdb file.
    Can u please let me know , how it is done?
    Thnx in advance
    Regards
    Vishal shewale
    [email protected]



  3. #3
    Join Date
    Apr 1999
    Posts
    38

    Re: How to use CompactDatabase with non .mdb files ?

    You should be able to do it, doing like that :

    CDaoDatabase daoBDD;
    CString szYourSourceFile = "C:\MySourceFile.XXX"
    CString szYourDestFile = "C:\MyDestFile.MDB"


    // To be sure that the CompactDatabase works and understands that
    // the file is an Access Base, you MUST pass it a ";pwd=" string
    // as a password.
    CString szConnection = ";pwd=" + "Your password";

    TRY
    {
    // La méhode pour encrypter est une méthode de CDAOWorkspace
    daoBDD.m_pWorkspace->CompactDatabase( szYourSourceFile,
    szYourDestFile,
    dbLangGeneral,
    dbEncrypt,
    szConnection);
    }

    CATCH(CDaoException, pException)
    {
    // Do whatever you want
    }
    END_CATCH
    }







Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured