locked
Sample Code - Sync TWO SQLCE databases RRS feed

  • Question

  • Hi there,

    I know there must be a good answer somewere, at least for my research so far I haven't been able to find any code to:

    1) To sync two SQL CE 3.5.1 databases
    2) One in the desktop, the other one in the mobile device

    My env is VS 2008, VB.Net

    Any code sample or at least a good, simple guideline will be greatly appreciated!

    Thanks in advance

    Gus
    Gus
    • Moved by Max Wang_1983 Thursday, April 21, 2011 11:19 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Sunday, September 6, 2009 6:54 AM

Answers

  • Gus,

    You can find sample code that demonstrates syncing 2 sql compact databases in the SyncFx v2 CTP 2 SDK found here:

    http://www.microsoft.com/downloads/details.aspx?FamilyID=89adbb1e-53ff-41b5-ba17-8e43a2e66254&displaylang=en

    The SDK lays the samples down in the following folders:

    C:\Program Files (x86)\Microsoft SDKs\Microsoft Sync Framework\2.0\Runtime\ADO.NET\V3.0\Samples

    Note that this release is targeted towards desktop bits only.  We are in the process of planning a devices release and would like to ship those bits before the end of CY 2009 although this is tentative at this point.

    Regards,

     

     

     


    Sean Kelley
    Senior Program Manager
    Microsoft
    Tuesday, September 8, 2009 8:24 PM
    Moderator
  • Absolutely.  You can sync two compact databases on the same desktop or two different desktops and the sample above demonstrates this.  If they are on two different computers, you would leverage WCF to listen for any incoming requests.  You are not required to have SQL Server running on either machine.


    Sean Kelley
    Senior Program Manager
    Microsoft
    Friday, September 18, 2009 12:47 PM
    Moderator

All replies

  • Gus,

    You can find sample code that demonstrates syncing 2 sql compact databases in the SyncFx v2 CTP 2 SDK found here:

    http://www.microsoft.com/downloads/details.aspx?FamilyID=89adbb1e-53ff-41b5-ba17-8e43a2e66254&displaylang=en

    The SDK lays the samples down in the following folders:

    C:\Program Files (x86)\Microsoft SDKs\Microsoft Sync Framework\2.0\Runtime\ADO.NET\V3.0\Samples

    Note that this release is targeted towards desktop bits only.  We are in the process of planning a devices release and would like to ship those bits before the end of CY 2009 although this is tentative at this point.

    Regards,

     

     

     


    Sean Kelley
    Senior Program Manager
    Microsoft
    Tuesday, September 8, 2009 8:24 PM
    Moderator
  • Gus,

    You can find sample code that demonstrates syncing 2 sql compact databases in the SyncFx v2 CTP 2 SDK found here:

    http://www.microsoft.com/downloads/details.aspx?FamilyID=89adbb1e-53ff-41b5-ba17-8e43a2e66254&displaylang=en

    The SDK lays the samples down in the following folders:

    C:\Program Files (x86)\Microsoft SDKs\Microsoft Sync Framework\2.0\Runtime\ADO.NET\V3.0\Samples

    Note that this release is targeted towards desktop bits only.  We are in the process of planning a devices release and would like to ship those bits before the end of CY 2009 although this is tentative at this point.

    Regards,

     

     

     


    Sean Kelley
    Senior Program Manager
    Microsoft

    Sean,

    Thanks a lot four your great help!

    My question now is, that sample will allow me to sync FROM THE PC to the DEVICE?

    IF yes, then I'm done so far and can wait to the device's bits.

    Thanks!
    Gus
    Tuesday, September 8, 2009 8:32 PM
  • Can two sql compact databases be synced without involving a local or remote server?
    Thursday, September 10, 2009 9:32 PM
  • The device bits to support this type of scenario is in progress.  Please tune into our blogs for more info before the end of the year.

    Regards,
    Sean Kelley
    Senior Program Manager
    Microsoft
    Sunday, September 13, 2009 10:53 PM
    Moderator
  • See above.

    Regards,
    Sean Kelley
    Senior Program Manager
    Microsoft
    Sunday, September 13, 2009 10:53 PM
    Moderator
  • While I agree that it would be nice to sync between a compact database on a device and one on a pc what I'm asking now is about the possibility to sync two SQL compact databases which are both on the local computer without using Sql Server. All the examples I've seen seem to indicate you need full or express versions of SQL Server installed. It's not practical for us to install a SQL server instance on each PC! Any suggestions?

    Also what is the address of your blog?
    Monday, September 14, 2009 1:04 PM
  • Absolutely.  You can sync two compact databases on the same desktop or two different desktops and the sample above demonstrates this.  If they are on two different computers, you would leverage WCF to listen for any incoming requests.  You are not required to have SQL Server running on either machine.


    Sean Kelley
    Senior Program Manager
    Microsoft
    Friday, September 18, 2009 12:47 PM
    Moderator
  • I have looked at the CE End-To-End SharingAppDemo Sample Application and find the following in it's readme.

    What is Demonstrated in This Sample?
    - Synchronizing a server database scope (hosted in a SQL Server or SQL Server Express instance) with multiple instances of a Compact client database.

    How Do I Install the Application?
    1- Connect to an instance of SQL Server, and open and execute peer1_setup.sql and then peer1_procs.sql.

    How Do I Use the Sample?
    2. Run the sample app. By default it assumes that SQL Server is installed as localhost.

    Maybe there is a way to make this work without having SQL Server or SQL Server Express installed but it's not obvious to me. Do I not have the sample you are referring to? The only other sample I have is the WebSharingAppDemo - End-To-End SharingAppDemo Sample Application and it has the same info in it's readme file.

    Thanks,
    Dave

    Sunday, September 20, 2009 1:48 AM
  • Maybe you've already figured it out, but I thought I'd post the steps that worked for me... 

    The sample apps do support peer syncing between two SqlCE databases, but it's just not that obvious as one would hope. In order to get to the point where you can play around with syncing two SqlCE dbs, you need to actually follow the instructions in the readme and setup the SQLServer.

    You can then click "Add CE Client" and create a new CE database by selecting "Full Init" and the location of where to create the DB (i.e. c:\temp\Peer1.sdf). This should now add an entry, Client1, into the Source/Destination Provider dropdowns. You can repeat the above steps (or select 'Snapshot Initialization' and select the newly created SqlCE database) and create another DB (i.e. c:\temp\Peer2.sdf) and this will add another entry, Client2, into the dropdown. 

    You can then select Client1/2 in the Source/Destination providers and then click the "Synchronize" button (I used another tool to insert/update/delete items in one of the SqlCE databases before performing a sync). The sample apps do work.

    Hope this helps others as I'm just starting to play around with the Sync Framework myself. In my case, we're using a SQLite database, so I can't use the SqlCESyncProvider, however I'm using this as a learning experience before I start down the path of possibly building our own SQLite sync provider for peer syncing.


    sush.
    Tuesday, September 22, 2009 3:14 PM
  • sush,

    This doesn't suprise me. From what I can tell the end result is that the information for syncing the to Compact databases is still in the server db. The point is that I'm working on a personal application that is aimed at people who may have limited technological expertise and since there is no need in the app for capabilities beyond what's available in SQL Compact I'm looking for a way to sync data (ultimatly between a PC and moble device) without the added complexity of having to install a server version of SQL.

    Thanks for the info though,
    Dave
    Tuesday, September 22, 2009 5:38 PM