locked
SqlSyncAdapterBuilder cannot generate upload commands RRS feed

  • Question

  •  

    Hi,  I'm trying to use Sync Framework 2.0 to build a test harness to sync some Microsoft RMS (Retail Mgt.) data.  Whether I use a sample I downloaded from MSDN or a new project I get the same error message.  This occurs whether I’m trying to configure the local database cache (per the video on the sync framework site) or running the “manual” code in one of the samples

     

    The dbo.Item table does have a primary key, which is the ID column (int).

     

    SQL 2008 with Change Tracking Enabled

    Microsoft Visual Studio 2008 (fails both in VB and C#)

    Sync Framework 2.0

    Vista Premium (diligently patched)

     

    I’ve tried uninstalling each component mentioned above and reinstalling; same result each time.  I haven’t tried Sync Framework 1.0 because I’m not sure it supports the 2008 change tracking.  That is to say, all the samples I have seen are based on generating tables and triggers manually.

     

    Here is the error:

    System.InvalidOperationException was unhandled

      Message="The SqlSyncAdapterBuilder cannot generate upload commands for table 'dbo.Item'. The table must contain a unique key, primary key, or ROWGUID column."

      Source="Microsoft.Synchronization.Data.Server"

      StackTrace:

        (edited for brevity)

     

    I really would like to use Sync Framework for a project I’m working on.  Any help would be tremendously appreciated whether it’s a solution or some additional trouble-shooting advise.  Thanks!

     

     

    • Moved by Hengzhe Li Friday, April 22, 2011 6:34 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Monday, January 12, 2009 11:46 PM

All replies

  • as the error indicated, does the table has a primary key on it ? a primary key is requred for table with change tracking.

     

    thanks

    Yunwen

    Tuesday, January 13, 2009 7:55 PM
    Moderator
  • Yes it has a primary key. 

     

    I also tried setting snapshot isolation, via sql:
    ALTER DATABASE [dbName] SET ALLOW_SNAPSHOT_ISOLATION ON

    which is recommended in the docs, and supposed to remove that requirement.

     

    It still fails with the same error.

     

    I tried making a new copy of the table using SQL Server Managment Studio.  I right
    clicked on the table and chose script table as/drop and create/new query
    window; then I renamed the table in the script and ran it.  The table was
    created without errors.  Then I created a new project and tried adding the
    Local Database Cache item.  This time I recieved the following error message:

    ---------------------------
    Failed to sync database
    ---------------------------
    Synchronizing the database failed with the message:

    'Unable to initialize the client database, because the schema for table
    'Item_02' 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.'
    ---------------------------
    OK  
    ---------------------------

    Could it be the first error is also due to GetSchema() failing?  If it can't get the schema, it can't tell that I have a PK. 

     

    Tuesday, January 13, 2009 8:05 PM
  • this is different the previous one, so can I assume the previous one is resolved ?

     

    for this "getSchema()" failure, can you check your code ( the generated code ) to see what the selectInrementalInsertCommand is ? also, if use the sql profiler to trace what command is run on the sql server to get the schema, it would be helpful here for this error.

     

    thanks

    Yunwen

    Tuesday, January 13, 2009 8:21 PM
    Moderator