Friday, January 2, 2009

Getting run time error message "The database file has been created earlier version of Sql Server compact."

Problem

When running samples/demos of the Sync Services intended for SQL Server CE 3.5 Beta 2 you receive the following message:
"The database file has been created by an earlier version of SQL Server Compact. Please upgrade using SqlCeEngine.Upgrade() method"
Cause

The reference in your project to the System.Data.SqlServerCe assembly is pointing to an older version of the file. This may occur if you already have Visual Studio 2005 installed on your PC.

Solution
In the Visual Studio project, ensure the file path of the System.Data.SqlServerCe reference points to the correct version – in this case SQL Server CE 3.5 Beta 2 (Desktop):
C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Desktop\System.Data.SqlServerCe.dll

An example of an incorrect file reference for SQL Server CE 3.5 Beta 2 is as follows:
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies\System.Data.SqlServerCe.dll

No comments: