none
Unable to enumerate changes at the DbServerSyncProvider RRS feed

  • Question

  • Hi, I building a small sync app to test the concept of a smart client I'm building. The application was working fine until I tried to filter the data coming from the server. When I filter on the PK ID field it works but when I filter on another text field I get:

    {"Unable to enumerate changes at the DbServerSyncProvider for table 'UserData' in synchronization group 'UserDataSyncTableSyncGroup'."}

    {"Invalid column name 'UserName'."}

     

    remoteProvider.UserDataSyncAdapter.SelectIncrementalInsertsCommand.CommandText = 

    IF @sync_initialized = 0 
    
    SELECT 
    dbo.UserData.[ID], 
    [UserName], 
    [UserData] 
    FROM dbo.UserData 
    LEFT OUTER JOIN CHANGETABLE(CHANGES dbo.UserData, 0) CT ON CT.[ID] = dbo.UserData.[ID] 
    WHERE ([UserName] = 'Louw') 
    AND  (CT.SYS_CHANGE_CONTEXT IS NULL OR CT.SYS_CHANGE_CONTEXT <> 'SOME TEXT') 
    
    
    ELSE  
    BEGIN 
    
    SELECT dbo.UserData.[ID], [UserName], [UserData] 
    FROM dbo.UserData JOIN CHANGETABLE(CHANGES dbo.UserData, @sync_last_received_anchor) CT ON CT.[ID] = dbo.UserData.[ID] 
    WHERE ([UserName] = 'Louw') 
    AND  (CT.SYS_CHANGE_OPERATION = 'I' 
    AND CT.SYS_CHANGE_CREATION_VERSION  <= @sync_new_received_anchor 
    AND (CT.SYS_CHANGE_CONTEXT IS NULL OR CT.SYS_CHANGE_CONTEXT <> @sync_client_id_binary)); 
    
    
    END
    

    I've manually changed the first select statement parameters so I can test it on the server and it executes without error.

    I'm using the standard wizards for local cache (SQL 2008 Change tracking enabled).

     

    Any pointers please : )

     

    thanks

    Thursday, December 8, 2011 6:26 AM

All replies

  • are you sure it is failing on the SelectIncrementalInsertsCommand?

    have you added a filter on the SelectIncrementalDeletesCommand?

    Thursday, December 8, 2011 10:07 AM
    Moderator