简体   繁体   English

如何通知表数据更改到客户端程序?

[英]How to notify table-data change to a client program?

Suppose I have an application that access data resident in a central DB server and more than one user access data from client machines networked with the DB server. 假设我有一个应用程序可以访问驻留在中央数据库服务器中的数据,并且有一个以上的用户可以从与数据库服务器联网的客户端计算机访问数据。

Suppose two client machines are running a copy of the application and two users are accessing the same DB table. 假设有两个客户端计算机正在运行该应用程序的副本,并且两个用户正在访问同一数据库表。

How can I automatically refresh the data on the GUI, that is being viewed by one client, as soon as a change is made by another client in the DB table-data? 一旦另一位客户端在数据库表数据中进行了更改,我如何自动刷新一个客户端正在查看的GUI上的数据?

Which technology should be used to solve this particular scenario in .net? 应该使用哪种技术来解决.net中的这种特定情况?

WCF? WCF?

You are looking for a notification push model. 您正在寻找通知推送模型。 You'd have to create seperate connections from the server back to each client. 您必须创建从服务器到每个客户端的单独连接。 Lots of hard work. 很多辛苦的工作。 WCF / sockets for this. WCF /套接字。 Comet in a web server environment. Web服务器环境中的Comet。

Much easier way to do this is to poll the server every 15 seconds or so from the client and check if there has been an update. 更简单的方法是每隔15秒左右从客户端轮询一次服务器,然后检查是否有更新。 Store a last updated timestamp on the server and if it is greater than the timestamp you have then do a refresh. 将最新的时间戳存储在服务器上,如果该时间戳大于时间戳,则进行刷新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM