我在创建 .NET 项目时遇到问题。我已经有一些扩展名为.sdf的数据库,每当我打算连接到它时,我都会收到以下错误:
The database file has been created by an earlier version of SQL Server Compact. Please upgrade using SqlCeEngine.Upgrade() method.
此外,我尝试使用以下代码段升级我的数据库:
@using System.Data.SqlServerCe
@{
var connStringCI = "Data Source= CRM.sdf;";
SqlCeEngine engine = new SqlCeEngine(connStringCI);
engine.Upgrade(connStringCI);
}
这次我得到以下编译错误(虽然我已经在我的项目中包含了 .dll 文件)
System.Data.SqlServerCe.SqlCeEngine' does not contain a definition for 'Upgrade' and no extension method 'Upgrade' accepting a first argument of type 'System.Data.SqlServerCe.SqlCeEngine' could be found (are you missing a using directive or an assembly reference?)
所以我决定使用可以为我进行升级的第三方工具。可以介绍一个吗?