Question

I need to modify an existing Windows CE app which gets it data from SQL Compact database (sdf) to update the database table (only 1 table) with latest records from a SQL Server Express when ever it is docked to the machine.

I came across Microsoft Sync Framework and it seems to be more than capable of enabling me to achieve my requirement. I tried one of their Walkthrough: Creating an Occasionally Connected Smart Device Application, but was not able to get the app working (the app I created based on the guide as well the sample code). The WCF service is hosted successfully and I can browse to the service from the browser as well.

I am encountering an error at the below line on the click event of SynchronizeMenuItem.

Dim syncStats As Global.Microsoft.Synchronization.Data.SyncStatistics = syncAgent.Synchronize()

Below is the trace from the output window:

'MobileSyncServices.exe' (Managed): Loaded 'System.SR.dll'
A first chance exception of type 'System.Net.WebException' occurred in System.dll
A first chance exception of type 'System.ServiceModel.EndpointNotFoundException' occurred in System.ServiceModel.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll
The thread 0x771e2c1e has exited with code 0 (0x0).
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll

I've been trying to find a solution for this problem as I didn't come across any after 2 days hence posting it here. I've installed all the framework/ service pack which are prerequisite for this as well. Have any of you tried this walk through and encountered a similar issue? What baffles me further is, that the sample code is also failing in two of my development machines (1 is Win XP and the Win 7).

Is there any other alternative way to update table in a Windows CE device with SQL Express Server when docked?

Was it helpful?

Solution

The requirment was to find a method to overwrite an table on a docked device (connected through ActiveSync/ Sync Center), achieved this by connecting to the SQL Server directly (by specifying either ip address) from the Pocket PC.

User would specify the SQL Server credentials Under system config/ options, which would be made use of to connect to the SQL Server. Once the desired data from the Server is broght down, the compact database is updated with the relevant data.

Below web resources paved the way to solve this issue and achieve the goal.

  1. Connecting to SQL Server Express from a Pocket PC application

  2. Accessing SQL Server Express from the emulator (or PDA)

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