Answered by:
Passing dynamic filter values to Sync Framework

Question
-
I am trying to follow this link's
http://msdn.microsoft.com/en-us/library/ff928701(SQL.110).aspx
to achieve Passing dynamic values to filter the table.
Error : Must declare the scalar variable @Custumertype Is there any sample out there to check.
I had seen in some post saying that it is a limitation is it?
Any help is Appretiated
Thanks
lavanyarMonday, October 25, 2010 11:16 PM
Answers
-
passing dynamic filter values is indeed a limitation. Sync Fx 2.1 filter templates can almost simulate this though. you can create a filter template and create multiple scopes based on the template but with different filter values.
i'm guessing you got the error above either because the SPs was not updated or the scope_config entry was not updated. or is it just a typo: Custumertype instead of Customertype?
- Marked as answer by Lavanyr Tuesday, October 26, 2010 4:39 PM
Tuesday, October 26, 2010 12:34 AM -
Hi,
Since you haven't provisioned "sale" scope on the server database, you cannot call below line yet:
DbSyncScopeDescription scopeDesc = SqlSyncDescriptionBuilder.GetDescriptionForScope("sales", new SqlConnection(serverCon));
Please reference the msdn example to create a new sync scope from an existing sync template: http://msdn.microsoft.com/en-us/library/microsoft.synchronization.data.sqlserver.sqlsyncscopeprovisioning.populatefromtemplate(v=SQL.110).aspx
Thanks,
Dong
This posting is provided AS IS with no warranties, and confers no rights.- Proposed as answer by Dong CaoMicrosoft employee Tuesday, October 26, 2010 6:03 PM
- Marked as answer by Lavanyr Tuesday, October 26, 2010 10:22 PM
Tuesday, October 26, 2010 6:03 PM
All replies
-
passing dynamic filter values is indeed a limitation. Sync Fx 2.1 filter templates can almost simulate this though. you can create a filter template and create multiple scopes based on the template but with different filter values.
i'm guessing you got the error above either because the SPs was not updated or the scope_config entry was not updated. or is it just a typo: Custumertype instead of Customertype?
- Marked as answer by Lavanyr Tuesday, October 26, 2010 4:39 PM
Tuesday, October 26, 2010 12:34 AM -
I am using Parameter-based Filters as you mentioned in your blog.
Firstly i am able to create the Template variable in SP on tables Customers. After that i am trying to crate the scope on the sampe table I am getting follofing error
Calling this function requires using a constructor that takes a SqlConnection. Please use a constructor that takes a SqlConnection, such as RelationalSyncProvider or any type that inherits from that class.
code : serverConfig.PopulateFromTemplate("sales", "Orders_OriginState_Filter_template");
sales : scope
thanks
lavanyarTuesday, October 26, 2010 1:08 AM -
did you initialize your serverConfig with a connection? eg. SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning(serverConn);Tuesday, October 26, 2010 1:39 AM
-
No,
I am using SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning();
One more thing the samples most of them in MSDN doest run with vs2010.
Thanks
lavanyarTuesday, October 26, 2010 3:27 AM -
you'll have to pass a connection. check the documentation/release notes for 2.1 on the changes to the provisioning methods/constructors.
am not sure which sample or what errors are you getting on the samples, if you can post it here, maybe people can help.
Tuesday, October 26, 2010 3:44 AM -
Not able to understand how to pass filter parameter from Client Side ConfigureLocalSqlSyncProvider.
Firstly i am able to create Template and scope on server.
I am having difficulty over her
private SqlSyncProvider ConfigureLocalSqlSyncProvider()
{
SqlSyncProvider provider = new SqlSyncProvider();
DbSyncScopeDescription scopeDesc = SqlSyncDescriptionBuilder.GetDescriptionForScope("sales", new SqlConnection(serverCon));
SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning(new SqlConnection(localCon), scopeDesc);
serverConfig.ObjectSchema = "dbo";
If i Uncomment below line to pass parameter its giving error
The current operation could not be completed because the database is not provisioned for sync or you not have permissions to the sync configuration tables.
//serverConfig.PopulateFromTemplate("sales", "Orders_OriginState_Filter_template");
//serverConfig.Tables["order_details"].FilterParameters["order_id"].Value = 4;
serverConfig.Apply();
return Provide;
}
I am aware that i am trying to pass filter parameter before provisioning the scope @ local(Client Side).
How should i approch this issue do i need to create scope in client side and later apply filtering condition at the time of synchronisation?
Thnaks
lavanyarTuesday, October 26, 2010 2:22 PM -
OOPs... Filter templates as it is cannot be used to synchronize.
June T thanks for help and can you update the 3 sample in your blog.
lavanyarTuesday, October 26, 2010 3:08 PM -
Hi,
Since you haven't provisioned "sale" scope on the server database, you cannot call below line yet:
DbSyncScopeDescription scopeDesc = SqlSyncDescriptionBuilder.GetDescriptionForScope("sales", new SqlConnection(serverCon));
Please reference the msdn example to create a new sync scope from an existing sync template: http://msdn.microsoft.com/en-us/library/microsoft.synchronization.data.sqlserver.sqlsyncscopeprovisioning.populatefromtemplate(v=SQL.110).aspx
Thanks,
Dong
This posting is provided AS IS with no warranties, and confers no rights.- Proposed as answer by Dong CaoMicrosoft employee Tuesday, October 26, 2010 6:03 PM
- Marked as answer by Lavanyr Tuesday, October 26, 2010 10:22 PM
Tuesday, October 26, 2010 6:03 PM