locked
Making OCA with sync service utilize dynamic table name RRS feed

  • Question

  • I'm working an OCA application based on a SQL server db and a SQL CE client db. Each user has there own table in the on the SQL server db. Each user's table has the same schema but can have different data. I'd like to make the synctable name to be dynamically set in the client application based on the their SQL server DB table name (which is set as userID + "__usersdatatable").

    The sync service runs without problems when I don't attempt to change anything. My latest idea was to change SyncTable.TableName = "jsmith_usersdatatable"; in the LocalDataCache1SyncAgent.cs in the oninitialized() method. However, I get the following error:

    "Unable to initialize the client database, because the schema for table 'zlentz_GOBOS' could not be retrieved by the GetSchema() method of DbServerSyncProvider. Make sure that you can establish a connection to the client database and that either the SelectIncrementalInsertsCommand property or the SelectIncrementalUpdatesCommand property of the SyncAdapter is specified correctly."

    In short the idea is that each OCA will need to sync to a different table (bidirectional). I'm obviously no SQL or sync Services expert so advice would helpful. :) Thanks in advanced!

    • Moved by Bob Wu-MT Tuesday, May 15, 2012 5:53 AM related to occasionally connected application (From:Windows Forms Data Controls and Databinding)
    Sunday, May 13, 2012 5:15 PM

Answers

  • have you tried using SqlSyncProvider/SqlCeSyncProvider/SyncOrchestrator instead of the Local Database Cache wizard?

    the newer providers allows you to specify a local and global names for your tables.

    • Marked as answer by Aaron Lentz Thursday, May 17, 2012 3:51 AM
    Wednesday, May 16, 2012 11:37 AM

All replies

  • Hi Aaron,
    According to your description, this issue is an issue about occasionally connected application. I will move it to the SyncFx - Microsoft Sync Framework Developer Discussions Forum for better support.
    Sorry for any inconvenience this may cause.
    Best Regards,

    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, May 15, 2012 5:52 AM
  • have you tried using SqlSyncProvider/SqlCeSyncProvider/SyncOrchestrator instead of the Local Database Cache wizard?

    the newer providers allows you to specify a local and global names for your tables.

    • Marked as answer by Aaron Lentz Thursday, May 17, 2012 3:51 AM
    Wednesday, May 16, 2012 11:37 AM
  • I appreciate the response! After learning more about the Sync Framework it was apparent that I needed to work outside the wizard.

    For future viewers the following link was very helpful:

    http://www.codeproject.com/Articles/18027/Take-Data-Offline-Using-Microsoft-Synchronization

    Thursday, May 17, 2012 3:56 AM