Friday, April 15, 2016

Use SQL Compact Server 3.5 with Windows CE 7

Background

I have a .NET CF 3.5 app running on Windows CE 6 that uses SQL Server compact 3.5.
I want it to run on Windows CE 7.

Here is an overview of how I achieved that.

Attempt 1: No modification


Simply build the code with the SDK of the new platform and deploy.
Result: 
- FAILED ! Native exception occurs at runtime (Native.GetKeyInfo ...)

Attempt 2


As explained in this article, double check the native sql dll versions (sqlceca35.dll, sqlcecompact35.dll, sqlceme35.dll, ...) and ensure that they match with the version of the System.Data.SqlServerCe assembly used in your .NET application.
For your information:

  •  v. 5386 : SQL Compact server 3.5 RTM
  •  v. 5692 : SQL Compact server 3.5 SP1
  •  v. 8080 : SQL Compact server 3.5 SP2


You can also take a look at this article for hotfixes list.

Result:
FAILED ! Did not work either, even with the same versions of dlls. The same exception occured.

Attempt 3 


Uninstall all SQL Server compact versions from your computer, reboot and install SQL Compact server 3.5 SP2.
Update the binaries in your application and try again.

Result:
FAILED ! New issue !

The application is trying to load native components of version 8154 that are incompatible with ADO.NET provider of version 8080

It's like the OS is loading its own set of native sql dlls instead of the ones in the application directory...

Attempt 4


If you don't already have it, install Windows CE 7 from here (warning: it is a loooong process. Install it only for the required cpu architecture).

In your project, use the native dlls located in C:\WINCE700\others\sqlcompact\<cpu>\retail and the assembly in C:\WINCE700\others\sqlcompact\managed\retail.

Result:
- SUCCEEDED ! The application runs flawlessly now !

Conclusion


After checking the versions of the dlls used in attempt 4, I found out that the binaries have been updgraded to 8154. I did not find any installer of SQL Server Compact 3.5 for Devices with this version (maybe I should have tried harder).
Know that for some people, attempt 2 resolved the issue but the only solution that worked for me was the last one.

Cem SOYDING

Author & Editor

Senior software engineer with 12 years of experience in both embedded systems and C# .NET

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.

 
biz.