Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. public static void SetUp(string _pScopeName, DbSyncTableDescription _pDbSyncTable, SqlConnection serverConn, SqlConnection clientConn)
  2. {
  3.  
  4. // Create a scope named "_ITEM" and add tables to it.
  5. DbSyncScopeDescription productScope = new DbSyncScopeDescription(_pScopeName);
  6.  
  7. // Define the Products table.
  8.  
  9.  
  10.  
  11. // Add the Table to the scope object.
  12.  
  13. productScope.Tables.Add(_pDbSyncTable);
  14. // Create a provisioning object for "_ITEM" and apply it to the on-premise database if one does not exist.
  15. SqlSyncScopeProvisioning serverProvision = new SqlSyncScopeProvisioning(serverConn, productScope);
  16. serverProvision.ObjectSchema = ".dbo";
  17. string _tblName = _pDbSyncTable.LocalName.Replace("[", "").Replace("]", "");
  18. serverProvision.SetCreateTableDefault(DbSyncCreationOption.Skip);
  19. serverProvision.Tables[_tblName].AddFilterColumn("_WORKGROUPNAME");
  20. serverProvision.Tables[_pDbSyncTable.LocalName].FilterClause = "[" + _tblName + "].[_WORKGROUPNAME] = " + _CCompanyVar._WORKGROUPNAME;
  21. //Skip create Sync Framework objects because we have already created them on the previous step
  22. serverProvision.SetCreateTableDefault(DbSyncCreationOption.Skip);
  23. //Create new select changes procedure for our scope
  24. serverProvision.SetCreateProceduresForAdditionalScopeDefault(DbSyncCreationOption.Create);
  25. if (_CPubVar._Stop_bool)
  26. {
  27. return;
  28. }
  29. if (!serverProvision.ScopeExists(_pScopeName))
  30. serverProvision.Apply();
  31.  
  32. // Provision the SQL client database from the on-premise SQL Server database if one does not exist.
  33. SqlSyncScopeProvisioning clientProvision = new SqlSyncScopeProvisioning(clientConn, productScope);
  34.  
  35. if (_CPubVar._Stop_bool)
  36. {
  37. return;
  38. }
  39. if (!clientProvision.ScopeExists(_pScopeName))
  40. clientProvision.Apply();
  41.  
  42. }
  43.  
  44. The multi-part identifier "_ATTENDANCESTATUS._WORKGROUPNAME" could not be bound.
  45. Invalid column name 'FPR'.
  46.  
  47. serverProvision.Apply();
  48.  
  49. string _tblName = _pDbSyncTable.LocalName.Replace("[", "").Replace("]", "");
  50. serverProvision.SetCreateTableDefault(DbSyncCreationOption.Skip);
  51. serverProvision.Tables[_tblName].AddFilterColumn("_WORKGROUPNAME");
  52. serverProvision.Tables[_pDbSyncTable.LocalName].FilterClause = "[" + _tblName + "].[_WORKGROUPNAME] = " + _CCompanyVar._WORKGROUPNAME;
  53. //Skip create Sync Framework objects because we have already created them on the previous step
  54. serverProvision.SetCreateTableDefault(DbSyncCreationOption.Skip);
  55. //Create new select changes procedure for our scope
  56. serverProvision.SetCreateProceduresForAdditionalScopeDefault(DbSyncCreationOption.Create);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement