Previous | Index | Next 

[PRB] The DAO RepairDatabase method causes a compilation error

Starting with version 1.00.06, VB Migration Partner converts all DAO references using DAO 3.6. (Previous versions used DAO 3.51.) This change ensures that Jet 4.0 databases can be accessed in the best way, however it introduces a minor issue because DAO 3.6 doesn’t support the RepairDatabase method any longer. Any reference to this method causes a compilation error in the VB.NET project. For more information, read this Microsoft KB article.

The simplest work around for this issue is a ReplaceStatement pragma that replaces the RepairDatabase with a CompactDatabase method and then copies the compacted database over the old file, as in this example:

     '## ReplaceStatement DAO_DBEngine_DefInstance.CompactDatabase("c:\db.mdb", "c:\db2.mdb"): 
                          System.IO.File.Delete("c:\db2.mdb"):
                          System.IO.File.Move("c:\db2.mdb", "c:\db.mdb")
     DBEngine.RepairDatabase "c:\db.mdb"

 

 

Previous | Index | Next