Question

I have a rugged device application (.NET CF) using a SQL CE 3.5 SP 2 database that synchronizes with an SQL Server 2008 using Microsoft Sync Framework 2.1 via USB when the device is docked into the cradle.

Recently, the device application has been experiencing some database corruption with the SDF so I implemented some maintenance code that runs on startup which uses the SqlCeEngine Verify, Repair, and Compact methods. Basically the app checks the SDF using the verify method, repairs it (or fails), and then compacts it before launching the application.

Everything has been working pretty good since then, so I just implemented the code that executes the same routine every time the device is synchronized, when I found this KB article from Microsoft:

After you execute the SqlCeEngine.Compact method against a SQL Server Compact 3.5 client database that is synchronized to a central database server, some changes to the client database may not be uploaded - http://support.microsoft.com/kb/967502#appliesto

This article is pretty vague and provides no information as to why this happens or if it has been fixed in SQL CE 3.5 SP 2. Can anyone provide a bit more info as to why this issue occurs?

Also the article suggested workaround is to use the Shrink method instead, but considering that they (essentially) perform the same function, why would we be able to use Shrink but not Compact?

I understand that the article refers to Microsoft Synchronization Services for ADO.NET and not Sync Framework 2.1 but I just wanted to check if this issue applies in my situation. My understanding is that Sync Services for ADO.NET is built on top of Sync Framework and it allows for synchronization using a WCF service.

I've run tests where I make changes on both the client and the server (bi-directional synchronization), compact the SDF and then sync with server, and everything seems to be synchronizing properly but I want to be sure.

If anyone could provide some info on this, it would be very much appreciated.

Was it helpful?

Solution

the Compact() method creates a new database and sometimes the sync anchor actually get's reset

see: http://support.microsoft.com/kb/969858

if you're using it on Windows Mobile devices, that's the Synchronization for Services for ADO.NET (Devices) that you're using.

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