Hello,
Is it possible to do a programmatic rebuild of a sdf db file?I want to do this in case my app will collapse
and say the db is corrupt.

using System.Data.SqlServerCe;
using System.IO;

  string connectionString;
  string fileName = "FileName.sdf";
  string password = “password”;

  if (File.Exists(fileName))
  {
    File.Delete(fileName);
  }

  connectionString = string.Format(
    "DataSource=\"{0}\"; Password='{1}'", fileName, password);
  SqlCeEngine scen = new SqlCeEngine(connectionString);
  scen.CreateDatabase();

Follow this,
http://arcanecode.com/2007/01/25/create-a-sql-server-compact-edition-database-with-c/