How to fix Bi-Directional Synchronization?

半城伤御伤魂 提交于 2019-12-25 03:22:06

问题


I have a problem with the logic of my synchronization.

Client Database Table Column:
- LastSync (Datetime - This tracks when the last sync occurs)
- LastUpdated (Datetime - This tracks when the data is last updated regardless if its the client or server who updated the data)

Server Database Table Column:
- ServerUpdate (Datetime - This tracks when the server last updated the data)
- ClientUpdate (Datetime - This tracks when the client/user updated the data)

My problem:

To keep the client/user's data updated I get the data from the server whose ServerUpdate is greater than the ClientUpdate (Sample SQL: "Select ID FROM tblContacts WHERE ServerUpdate > ClientUpdate") then I update the client side (meaning I updated the data and the LastSync and LastUpdated).

The problem is when I sync the data of the client it always get the data whose ServerUpdate is greater than the ClientUpdate even though the data is already updated.

For example, the client sync the New Password (that the server changed) of my user that means the ServerUpdate is greater than the ClientUpdate. When you sync the data it will be updated in the client side. However, when you sync again the server is still passing the same data even though the data is already updated.

What can I do to get only the data that is not yet updated even if the ServerUpdate is greater than ClientUpdate?

来源:https://stackoverflow.com/questions/53581483/how-to-fix-bi-directional-synchronization

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!