SyncFramework with SQL Server
I have three tables in SQL Server 2008
- Account
- Case
- CaseStatus
Table Case
has a reference using column AccountId
to AccountTable
, and CaseStatus
has a reference on caseId
to table Case
.
I need to sync these three table depending on AccountId(Accou开发者_如何学JAVAntTable)
. Please help me to write code (template) in Microsoft Sync Framework
If I understand correctly, you want to use an AccountId selected on the client side to sync data from all three tables to the client, but limited to the AccountId.
Pass along the accountId as a parameter when filtering (see How to: Filter Data for Database Synchronization (SQL Server))
Next, you need to rewrite the filterclause with subselects to something like this, assuming you name your parameter 'AccountId':
Account table: side.AccountId = @AccountId
Case table: side.AccountId = @AccountId
CaseStatus table: side.CaseId in (Select CaseId from Case Where AccountId = @AccountId)
are you filtering on AccountID?
you can set the FilterClause for the Case table to "side.AccountId in (Select AccountId from AccountTable)"
and for CaseStatus table to "side.CaseId in (Select CaseId from Case)"
精彩评论