本文整理汇总了C#中SqlCeEngine.Repair方法的典型用法代码示例。如果您正苦于以下问题:C# SqlCeEngine.Repair方法的具体用法?C# SqlCeEngine.Repair怎么用?C# SqlCeEngine.Repair使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlCeEngine
的用法示例。
在下文中一共展示了SqlCeEngine.Repair方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RepairDatabaseRecoverAllPossibleRows
public void RepairDatabaseRecoverAllPossibleRows(string connectionString)
{
using (SqlCeEngine engine = new SqlCeEngine(connectionString))
{
engine.Repair(connectionString, RepairOption.RecoverAllPossibleRows);
}
}
示例2: RepairDatabaseRecoverAllOrFail
public void RepairDatabaseRecoverAllOrFail(string connectionString)
{
using (SqlCeEngine engine = new SqlCeEngine(connectionString))
{
engine.Repair(connectionString, RepairOption.RecoverAllOrFail);
}
}
示例3: RepairDatabaseDeleteCorruptedRows
public void RepairDatabaseDeleteCorruptedRows(string connectionString)
{
using (SqlCeEngine engine = new SqlCeEngine(connectionString))
{
engine.Repair(connectionString, RepairOption.DeleteCorruptedRows);
}
}
示例4: Repair
public ActionResult Repair()
{
var engine = new SqlCeEngine(ConfigurationManager.ConnectionStrings["FeedsDbEntities"].ConnectionString);
// Specify null destination connection string for in-place repair
engine.Repair(null, RepairOption.RecoverAllOrFail);
return View();
}
示例5: Repair
/// <summary>
/// Repairs a corrupted database. Call this method when <see cref="Verify"/> returns false. Applies only to SQL CE.
/// </summary>
internal static void Repair()
{
using (SqlCeEngine engine = new SqlCeEngine(Util.ConnectionString))
{
engine.Repair(null, RepairOption.RecoverAllPossibleRows);
}
}
示例6: Repair
/// <summary>
/// Repairs a corrupted database. Call this method when <see cref="Verify"/> returns false.
/// </summary>
public void Repair()
{
using (var engine = new SqlCeEngine(ConnectionString))
{
engine.Repair(null, RepairOption.RecoverAllPossibleRows);
}
// Same thing using Reflection:
//object sqlCeEngine = null;
//try
//{
// sqlCeEngine = SqlCeEngineType.InvokeMember(null, BindingFlags.CreateInstance, null, null, new object[] { ConnectionString });
// var repairOptionEnumType = SqlCeAssembly.GetType("System.Data.SqlServerCe.RepairOption");
// var repairOptionRecoverAll = repairOptionEnumType.GetField("RecoverAllPossibleRows").GetValue(repairOptionEnumType);
// SqlCeEngineType.InvokeMember("Repair", BindingFlags.InvokeMethod, null, sqlCeEngine, new[] { null, repairOptionRecoverAll });
//}
//catch (TargetInvocationException ex)
//{
// AppEventController.LogError(ex.InnerException ?? ex);
// throw;
//}
//finally
//{
// if (sqlCeEngine != null)
// SqlCeEngineType.InvokeMember("Dispose", BindingFlags.InvokeMethod, null, sqlCeEngine, null);
//}
}