VistaDB 6
VistaDB.Provider Namespace / VistaDBConnection Class / RepairDatabase Method / RepairDatabase(String,OperationCallbackDelegate) Method
File name of the database to repair.
VistaDB.DDA.OperationCallbackDelegate method for feedback of repair progress. You may pass null or Nothing if callbacks are not needed.


In This Topic
    RepairDatabase(String,OperationCallbackDelegate) Method
    In This Topic
    Attempt to repair an unencrypted partially corrupted database file.
    Syntax
    'Declaration
     
    
    Public Overloads Shared Sub RepairDatabase( _
       ByVal fileName As System.String, _
       ByVal operationCallbackDelegate As OperationCallbackDelegate _
    ) 
    'Usage
     
    
    Dim fileName As System.String
    Dim operationCallbackDelegate As OperationCallbackDelegate
     
    VistaDBConnection.RepairDatabase(fileName, operationCallbackDelegate)
    public static void RepairDatabase( 
       System.string fileName,
       OperationCallbackDelegate operationCallbackDelegate
    )

    Parameters

    fileName
    File name of the database to repair.
    operationCallbackDelegate
    VistaDB.DDA.OperationCallbackDelegate method for feedback of repair progress. You may pass null or Nothing if callbacks are not needed.
    Remarks

    Attempt to repair a partially corrupted database file by performing a pack operation with more tolerance for errors by dropping rows or tables which can not be successfully read rather than aborting the entire operation. Thus DATA LOSS CAN OCCUR despite apparent "success" of the repair. This operation is most successful at repairing corruption within indexes since they are simply dropped and recreated.

    Always create a backup copy of the database before attempting a Repair. Once a RepairDatabase has completed (or progressed beyond a certain point) recovery of any lost data will not be possible without a backup from before the operation.

    Constructs like constraints and triggers are ignored during a Repair and may be left in an invalid state requiring manual repairs to make them valid again and possibly then recreating the constraint once the data can pass.

    Because of the potential for loss of data and schema and the need to check the resulting database before assuming a Repair was successful, a RepairDatabase should not be invoked automatically just because a PackDatabase failed. It could be provided as a user-triggered support option or performed offline as support for your clients.

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also