当新记录插入数据库时​​触发Windows服务 [英] Trigger Windows Service when the new record insert in to database

查看:62
本文介绍了当新记录插入数据库时​​触发Windows服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无论如何我可以在C#中编写一个Windows服务,当新记录插入数据库时​​会触发。

Is there's anyway i can write a windows service in C# that will be trigger when the new record get inserted into Database.

推荐答案

是的,有办法,您可以在Windows服务中使用SQL依赖项。

虽然这篇文章: http://www.codemag .com / article / 0605061 [ ^ ]全部它是VB.Net中的代码示例,我确实发现它是介绍这个前提的优秀文章。



您需要确保设置的某些要求关于SQL和数据库所有者,服务代理可能会失败,就像我最近发生的那样。



希望有帮助/
Yes there is a way, you can use a SQL Dependency in the windows service.
Although this article :http://www.codemag.com/article/0605061[^] has all it's code examples in VB.Net, I did find it an excellent article to introduce this premise.

There are certain requirements that you need to ensure have been set up with regards to SQL and database owners else the service broker might fail, as happened to me recently.

Hope that helps/


这篇关于当新记录插入数据库时​​触发Windows服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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