Question

I seem to have the same issue as another user here SQLServerCE SDF file on Windows 7 however the advice from that thread hasn't resolved my issue.

This relates to SQL Server CE v3.1 (DLL Version 3.0.5300.0) whereby I am able to build the SDF file using a utility on a Windows XP 32 bit machine but using the same compiled code and DLL's on both my Win 7 Dev Machine & a Standalone Win 8 Machine it will not allow the database to be queried correctly on the device.

Say for example.

SELECT Name FROM USERS WHERE Name = 'Joey'

Should return 1 result from the DB. If it was compiled on the windows XP machine it will work, if it is compiled on a Windows 7 / 8 machine it wont be read and the result set is 0.

This some odd behaviour as not all queries are effected. If the same table is queried with a different where clause, the result is different. Checking the file directly in VS 2005 or using a utility I wrote to read out .SDF files, I can see the query works fine on both Windows 7 / 8.

It would appear this only becomes an issue once the SDF file is copied to the Windows 6.5 device. This has the same DLL's as the application that built the file SQL Server CE v3.1 (DLL Version 3.0.5300.0).

I have checked and can see it's not down to the x64 / x32 architecture as it's the same result when building on a 32 bit or 64 bit Win 7 or Win XP machine.

From the last post I did see some breif but helpful info from MS (http://blogs.msdn.com/b/sqlservercompact/archive/2009/04/01/after-moving-the-database-from-one-platform-to-other-the-first-sqlceconnection-open-takes-more-time.aspx)

I am looking for a resolution to this, but any additional information would help such as... how to check the DLL version running on the device (like the Modules) window in Visual Studio would really help.

Was it helpful?

Solution

If you ever have such misfortune to have to use an early version of SQL Server CE (< 3.0.5300.0) then this is an interesting issue. Whilst it was a limitation at the time it's taken a while to work through to a resolution.

I re-checked over everything on the device. Now whist the installer package had the right DLL included in it for 3.0.5300.0 these were not copied to the application directory "$\DEVICE\Program Files\My Application". In order for me to be able to compile the database on Windows 7 /8 and have that database work on a Windows 6.5 device I had to manually ensure that the correct files were in both the desktop application and on the windows device.

The files I included in both applications were as follows:-

  • sqlceca30.dll
  • sqlcecompact30.dll
  • sqlceer30EN.dll
  • sqlceme30.dll
  • sqlceoledb30.dll
  • sqlceqp30.dll
  • sqlcese30.dll
  • System.Data.SqlServerCe.dll

They have a version of 3.0.5300.0 and date modified of 22/12/2006 and I sourced them from "C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v3.1", when compiling under any earlier version (for me anyway) failed.

Hope it helps anyone else who might get stuck with this as I didn't see much out there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top