How can I upgrade my Sql Server CE 3.5 sdf database to Sql Server CE 4.0?

后端 未结 2 836
感情败类
感情败类 2020-12-25 13:10

I need to update my SqlCE3.5 database to 4.0.

I get the following error message when I\'m trying to access my 3.5 sdf/database using the new CE4.0 connection provide

相关标签:
2条回答
  • 2020-12-25 13:39

    You needn't upgrade when you see this error:

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

    Simply:

    1. Right-click your Project in Solution Explorer
    2. Choose properties, go to References tab
    3. You'll see a reference called: System. Data.SqlServerCe Type/net version/4.0 - delete this item (select item and then click remove in the bottom of this window).
    4. Click on the "add..." button left of the "remove" button
    5. In the .NET tab, find System.Data.SqlServerCe 3.5 and add this.
    6. Compile your project!

    I think this will work.

    0 讨论(0)
  • 2020-12-25 13:50

    Call System.Data.SqlServerCe.SqlCeEngine.Upgrade. See MSDN, which contains sample code.

    0 讨论(0)
提交回复
热议问题