SqlCeEngine.Verify Method

Recalculates the checksums for each page in the database and compares the new checksums to the expected values.

Namespace:  System.Data.SqlServerCe
Assembly:  System.Data.SqlServerCe (in System.Data.SqlServerCe.dll)


Public Function Verify As Boolean
Dim instance As SqlCeEngine
Dim returnValue As Boolean

returnValue = instance.Verify()
public bool Verify()
bool Verify()
member Verify : unit -> bool 
public function Verify() : boolean

Return Value

Type: System.Boolean
True if the checksums match and there is no database corruption; otherwise, false.


If this method returns false, the database is corrupt, and your application should call the Repair method to correct the problem.


False is also returned if there is a failure connecting to the database. Scenarios include an incorrect password, or the database file is inaccessible.


Dim engine As New SqlCeEngine("Data Source = AdventureWorks.sdf")

If False = engine.Verify() Then
    MessageBox.Show("Database is corrupted.")
    engine.Repair(Nothing, RepairOption.RecoverCorruptedRows)
End If
SqlCeEngine engine = new SqlCeEngine("Data Source = AdventureWorks.sdf");

if (false == engine.Verify())
    MessageBox.Show("Database is corrupted.");
    engine.Repair(null, RepairOption.RecoverCorruptedRows);

See Also


SqlCeEngine Class

Verify Overload

System.Data.SqlServerCe Namespace