通过查询sql数据库发送警报

时间:2021-11-12 09:13:07

I have created a windows service which will query sql table and check for last 3 minutes data to decide the status of device using the same if all data is zero the device is zero its considered to be off other wise on if no data is present device is offline. But the problem I'm facing is windows service has to query database very frequently is there any alternative way to do this.

我已经创建了一个Windows服务,它将查询sql表并检查最后3分钟的数据以决定使用相同的设备的状态如果所有数据都为零,则设备为零,如果没有数据存在则认为是其他方式关闭离线。但我面临的问题是Windows服务必须经常查询数据库是否有任何替代方法来执行此操作。

1 个解决方案

#1


0  

SqlDependency Class seems appropriate in this scenario.

在这种情况下,SqlDependency类似乎是合适的。

The SqlDependency object represents a query notification dependency between an application and an instance of SQL Server. An application can create a SqlDependency object and register to receive notifications via the OnChangeEventHandler event handler.

SqlDependency对象表示应用程序与SQL Server实例之间的查询通知依赖关系。应用程序可以创建SqlDependency对象并注册以通过OnChangeEventHandler事件处理程序接收通知。

Links: CodeProject MSDN

链接:CodeProject MSDN

#1


0  

SqlDependency Class seems appropriate in this scenario.

在这种情况下,SqlDependency类似乎是合适的。

The SqlDependency object represents a query notification dependency between an application and an instance of SQL Server. An application can create a SqlDependency object and register to receive notifications via the OnChangeEventHandler event handler.

SqlDependency对象表示应用程序与SQL Server实例之间的查询通知依赖关系。应用程序可以创建SqlDependency对象并注册以通过OnChangeEventHandler事件处理程序接收通知。

Links: CodeProject MSDN

链接:CodeProject MSDN