Article ID: 974247 - View products that this article applies to.
On 64-bit computers, a SQL Server Compact (“Compact”) based application may fail with one of the following two symptoms:
The application is trying to load a version of Compact that is incompatible with the version that is installed on the computer. Incorrect versions could lead to application instability and the loading of Compact would be aborted.
The application cannot load the native components of SQL Server Compact that corresponds to the ADO.NET provider.
The following are the exact exceptions that are associated with these issues:
Version Mismatch Exception
File version mismatch detected between ADO.NET Provider and native binaries of SQL Server Compact which could result in an incorrect functionality. This could be due to the presence of multiple instances of SQL Server Compact of different versions. Please install SQL Server Compact binaries of matching version [ADO.NET Provider File Version = XXXX, Native Binary File Version = YYYY]
Unable to load ME dll Exception”
Unable to load DLL 'sqlceme35.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
Compact based applications generally program against the Compact ADO.NET provider (System.Data.SqlServerCe.dll). This provider in-turn communicates with the native Compact components. In order to avoid various inconsistencies, a Compact ADO.NET provider of a certain version can talk only to the Compact native components of the same version. The following are some sample scenarios where this policy will be broken, and that will result in one of the previously mentioned two exceptions:
Example Scenario 1Install SQL Server 2008 R2 (this installs the 32-bit version of SQL Server Compact 3.5 SP2).Then, when you run a 64-bit application privately deploying SQL Server Compact SP1, It fails with the “Version Mismatch" exception.
Reason for the failure
Example Scenario 2
Reason for failure
At any given point of time, the correct state of a 64-bit computer, for SQL Server Compact, would be the following:
Therefore, if you face any similar issues, make sure that the computer has both x86 and amd64 MSIs of Compact are installed and they are of the same version. In case, they are not, then install Compact SP2 x86 and x64 MSIs from following link as needed:
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.