locked
TSQL filter for CE ? RRS feed

  • Question

  •  

    Hello All,

     

    Can anyone show how to add some TSQL to a SyncAdapter to bring down records from a where clause to CE from the server? I want only to sync table data for a specific user... by alias.

     

    I'm working with the below example:

     

    'DEFAULT

    Dim tableProposalDetail As SyncTable = New SyncTable("MyTable")

    tableProposalDetail.CreationOption = TableCreationOption.TruncateExistingOrCreateNewTable

    tableProposalDetail.SyncDirection = SyncDirection.Bidirectional

    '

    Dim orderGroup As SyncGroup = New SyncGroup("AllChanges")

    tableMyTable.SyncGroup = orderGroup

    '

    syncAgent.SyncTables.Add(tableMyTable)

    '

    ' base table

    DetailBuilder.TableName = "MyTable"

    DetailBuilder.DataColumns.Add("tblID")

    DetailBuilder.DataColumns.Add("SQLkey")

    DetailBuilder.DataColumns.Add("CreateDateTime")

    DetailBuilder.DataColumns.Add("Alias")

    DetailBuilder.DataColumns.Add("DNumb")

    DetailBuilder.DataColumns.Add("DRevNumb")

    DetailBuilder.DataColumns.Add("DLine")

    DetailBuilder.DataColumns.Add("create_timestamp")

    DetailBuilder.DataColumns.Add("update_timestamp")

    DetailBuilder.DataColumns.Add("update_originator_id")

    DetailBuilder.DataColumns.Add("create_date")

    '

    Dim DetailBuilderAs SqlSyncAdapterBuilder = New SqlSyncAdapterBuilder()

    DetailBuilder.Connection = serverConnection

    DetailBuilder.SyncDirection = SyncDirection.Bidirectional

    '

    Dim DetailSyncAdapter As SyncAdapter = DetailBuilder.ToSyncAdapter()

    serverSyncProvider.SyncAdapters.Add(DetailSyncAdapter)

     

    ' SORT OF WHAT I'M TRYING TO DO.........................................................................................................

    'code to add the filter as

    syncAgent.CustomParameters.Add(New SyncParameter("@Alias", " '" & GetUserName & "'")) ' to get rows in MyTable

     

    'e.g. your command text as

    serverSyncProvider.SelectClientIdCommand.CommandText = String.Format("select * from MyTable where Alias=@Alias")

    '

    I'd like only to Update/Insert into CE from the SQL Server using a TSQL where clause.

     

    Any ideas?

     

    Thanks,

    billb

    • Moved by Max Wang_1983 Friday, April 22, 2011 8:46 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Wednesday, February 6, 2008 5:08 PM