locked
Local database cache never gets updated on smart device synchronization. RRS feed

  • Question

  • Hello everyone,

    I have a problem with synchronizing my smart device application with a sql server database. I have made a smart device application who synchronizes with my sql server database. I managed to get the synchronization working without exceptions but it never updates my local database cache. When I make a change on the server database and synchronize my client application, the SyncStatistics correctly tell me that the changes were downloaded from the server and applied to the client application. But when I check my local database cache afterwards, the data was not updated. Am I missing a piece here or is this a bug?

    Does anyone have the same problem, or has fixed this problem I have? It would be of great help.
    • Moved by Hengzhe Li Friday, April 22, 2011 7:53 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Monday, November 10, 2008 3:33 PM

Answers

  • I have found what was causing my problem. The problem was that on each deploy of my application, the .sdf database cache copied itself to my output directory on the mobile device. Once I changed the property to do not copy, the problem was solved. So on default, the empty .sdf database cache copies itself to the device so everytime I started the debug, I got an empty database.

    You can get rid of this problem by right clicking on your database cache, then select properties and set the Copy to Output Directory property to Do not copy.
    Wednesday, November 12, 2008 11:05 AM

All replies

  • Anyone who can help me with this problem? It's really causing me a headache!
    Tuesday, November 11, 2008 2:17 PM
  • Hi Rick

     

    I need more information to figure out what is the cause of the problem you are facing.  What sync provider are you using with your application?  On what direction are you synchronizing your data on your application? 

     

    Maria del Mar Alvarez Rohena - MSFT

     

     

    Tuesday, November 11, 2008 7:48 PM
  • Hi Maria,

    I will clear up my problem so that you may be able to help me. Below is the code I use to synchronize my data. I have created a local database cache named WerkbonMobiel.sync so my SyncAgent is WerkbonMobielSyncAgent. After I added a web reference from my WCF library to my project and after I changed the App.config so that my WCF Library can be called on by the client app, I created the CFClientBase.cs and WerkbonMobielSyncService.cs by calling the NetCFSvcUtil.exe from the .NET powertoys. On my form I have a MechanicDataTable which contains all the data from that table in the database. When I call the synchronize method, the DataTable get's filled properly but my Local database cache never get's updated. I hope this is enough information for you to maybe figure out what my problem is.

            private void synchronize()
            {
                WerkbonMobielSyncAgent syncAgent = new WerkbonMobielSyncAgent(new WerkbonMobielSyncContractClient());
                syncAgent.MECHANIC.SyncDirection = SyncDirection.Bidirectional;
                try
                {
                    SyncStatistics syncStats = syncAgent.Synchronize();
                    mECHANICTableAdapter.Fill(werkbonMobielDataSet.MECHANIC);
                }
                catch (Exception ex)
                {
                    Utility.createErrorLog(ex);
                }
            }

    Rick.
    Wednesday, November 12, 2008 7:37 AM
  • I have found what was causing my problem. The problem was that on each deploy of my application, the .sdf database cache copied itself to my output directory on the mobile device. Once I changed the property to do not copy, the problem was solved. So on default, the empty .sdf database cache copies itself to the device so everytime I started the debug, I got an empty database.

    You can get rid of this problem by right clicking on your database cache, then select properties and set the Copy to Output Directory property to Do not copy.
    Wednesday, November 12, 2008 11:05 AM
  • Hi Rick

     

    Thanks for letting us know how you solved this problem.  This might be of help to someone else in the future!

     

    Maria del Mar Alvarez Rohena - MSFT

     

    Wednesday, November 12, 2008 7:26 PM