且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

是否可以使用SQL表依赖性监视多个表数据更改?

更新时间:2023-01-29 20:08:42

嗯......根据MSDN文档:

Well... As per MSDN documentation:
引用:

SqlDependency允许您在数据库中的原始数据发生变化时接收通知,以便刷新缓存。



要设置依赖项,需要将SqlDependency对象与一个或多个SqlCommand对象相关联。要接收通知,您需要订阅OnChange事件。有关创建通知查询的要求的详细信息,请参阅SQL Server联机丛书中的为通知创建查询。

SqlDependency allows you to receive notifications when the original data in the database changes so that the cache can be refreshed.

To set up a dependency, you need to associate a SqlDependency object to one or more SqlCommand objects. To receive notifications, you need to subscribe to the OnChange event. For more information about the requirements for creating queries for notifications, see "Creating a Query for Notification" in SQL Server Books Online.







详情请见:

SqlDependency类(System.Data.SqlClient) [ ^ ]

使用SqlDependency检测更改 [ ^ ]

CodeProject知识库文章:

使用SqlDependency和SqlCacheDependency查询通知 [ ^ ]

使用SqlDependency进行数据更改事件 [ ^ ]




For further details, please see:
SqlDependency Class (System.Data.SqlClient)[^]
Detecting Changes with SqlDependency[^]
Articles of CodeProject Knowledge Base:
Query Notification using SqlDependency and SqlCacheDependency[^]
Using SqlDependency for data change events[^]