用Hmailserver ,sqlce3.5数据库坏了,连接打不开, 引擎坏了报错25017,用C#修复,原来300M变240了。我上学编程都没好好学,USING 找个半天 Sqlserverce;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlServerCe;
using System.Data;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
SqlCeEngine engine =
new SqlCeEngine("Data Source = C:\\Desktop\\test20210510\\***rver.sdf;;password=*******");
if (false == engine.Verify())
{
Console.WriteLine("Database is corrupted.");
try
{
engine.Repair(null, RepairOption.RecoverAllPossibleRows);
}
catch (SqlCeException ex)
{
Console.WriteLine(ex.Message);
}
}
Console.WriteLine("Press any key to continue.");
Console.ReadLine();
}
}
}