数据库中的数据更改时自动更新UI. [英] Automatically update UI when data changes in the database.

查看:131
本文介绍了数据库中的数据更改时自动更新UI.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果通过其他一些过程更改了数据库中的数据时的数据,是否有任何方法可以自动更新datagridview上的数据视图?
对不起,我的英语不好.

Is there any way to automatically update the data viewing on a datagridview if the data when data is changed in the database by some other processes?
Sorry for my bad english.

推荐答案

IIRC,您需要SQL通知服务.

实施SQL通知 [
IIRC you need SQL Notification service.

Implementing SQL Notification[^]


是否具有此功能取决于您正在使用的数据库引擎. Notification Server已从SQL Server 2008中删除.

首先,其他引擎从未具有通知服务的优势.

另一种选择是在数据库之上编写一个层,客户可以使用该层从数据库获取数据或向数据库写入数据.此层还将具有您的客户端订阅的机制,因此,当该层将数据写入数据库时​​,该层将向客户端发送通知.编写起来并不容易,但是使用Windows Communication Foundation会更容易.
If you even have this capability depends on the database engine you''re using. Notification Servers was removed from SQL Server 2008.

Other engines never had the equivilient of notification services in the first place.

Another option would be to write a layer on top of your database that your clients use to get/write data from/to the database. This layer would also have a mechanism that your clients subscribe to so when the layer writes data to the database, the layer would send a notification to the clients. This is NOT easy to write, but would be made easier with Windows Communication Foundation.


这篇关于数据库中的数据更改时自动更新UI.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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