更新C#的客户端,只要数据库被更新 [英] Update C# client whenever database is updated

查看:110
本文介绍了更新C#的客户端,只要数据库被更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用MySQL使用C#/ Visual Studio 2008中,我需要知道的任何方法,这样,如果一个用户更新了数据库,所有的登录用户通过网络,被告知已经发生了变化。 如果我记录在数据库中,通过我的申请,当时在数据库中的最新记录的序列号为10,然后我一个人的权限更新记录在数据库中,并在同一时间,我被通知数据库已经更新了一个新纪录。 常见的例子可能是MSN Messenger的警报的朋友,当他在网上得到... 虽然我真的不希望这种弹出,但警报的功能是类似的东西...

I am using MySQL with C# / Visual Studio 2008. I need to know any method so that if one user updates the database, all the logged in users over the network, are notified that a change has been occurred. If i logged in the database through my application, at that time the serial no of the latest record in the database was 10, and then i someone with the privileges updates the record in the database and at the same time i am being notified that the database has been updated with a new record. Common example can be of MSN messenger's alert for a friend when he gets online... Though i really don't want that popup, but alert functionality is something like that...

还有一件事要问: 我想就像如果记录的状态不更新(比如为约3小时以上)一个功能,那我希望所有用户得到警告有关问题也。这种功能是需要的所有记录,没有特别的新记录。

One more thing to ask: I want a functionality like if a record's status is not updated (for say about more than 3 hours), then i want all users to get alert about that issue also. This functionality is needed for all of the records, not specifically for new records.

推荐答案

您可能需要设计某种形式的投票功能,在您的客户端。例如,您可以发送一个请求,每分钟要求数据库你既然[日期最新的客户端得到了更新]更新吗?如果数据库的答案,你让客户端请求的全套更新。如果没有,你让它睡一分钟。

You probably need to design some kind of poll functionality in your client. For example, you can send a request each minute asking the database "Have you updated anything since [date the client latest got updates]?" If the database answers true, you let the client request the full set of updates. If not, you let it sleep another minute.

这篇关于更新C#的客户端,只要数据库被更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆