Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top