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 :-
System.Data.EntityException: The underlying provider failed on Open. ---> System.Data.SqlServerCe.SqlCeInvalidDatabaseFormatException: The database file has been created by an earlier version of SQL Server Compact. Please upgrade using SqlCeEngine.Upgrade() method.
Anyone know how I can do this? Obviously I need to do it programatcially but i'm not sure what I should do / what references I need to add, etc.
Cheers!
To upgrade an existing instance of SQL Server to a different edition, from the SQL Server Installation Center click Maintenance, and then select Edition Upgrade. If Setup support files are required, SQL Server Setup installs them. If you are instructed to restart your computer, restart before you continue.
An SDF file contains a compact relational database saved in the SQL Server Compact (SQL CE) format, which is developed by Microsoft. It is designed for applications that run on mobile devices and desktops and contains the complete database contents, which may be up to 4GB in size.
Call System.Data.SqlServerCe.SqlCeEngine.Upgrade
. See MSDN, which contains sample code.
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:
System. Data.SqlServerCe Type/net version/4.0
- delete this item (select item and then click remove in the bottom of this window).System.Data.SqlServerCe 3.5
and add this.I think this will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With