문제

I'm having trouble creating a .NET project. I already have some database with extension .sdf and whenever I intend to connect to it I get the following error:

The database file has been created by an earlier version of SQL Server Compact. Please upgrade using SqlCeEngine.Upgrade() method.

Moreover I tried upgrading my database using the following snippets:

@using System.Data.SqlServerCe
@{
    var connStringCI = "Data Source= CRM.sdf;";
    SqlCeEngine engine = new SqlCeEngine(connStringCI);   
    engine.Upgrade(connStringCI);
}

This time I get the following compile error (Although I have included the .dll file in my project)

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?)

So I decided to use a third party tool that can do the upgrade for me. Can you introduce one?

도움이 되었습니까?

해결책

You have to reference System.Data.SqlServerCe.dll version 4.0.0.0 in order to run Upgrade()

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top