Web应用程序知道数据库更新 [英] Web Application to know database update

查看:111
本文介绍了Web应用程序知道数据库更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Web应用程序(ASP.NET 4)连接到一个数据库(SQL Server 2005)。对于插入某个表的每一个新的行,我想Web应用程序可以做一些处理(例如发送电子邮件给我用新的数据)。

My web application (ASP.NET 4) connects to a database (SQL Server 2005). For every new row inserted in a certain table, I want the web app can do some process (like send an email to me with new data).

我如何实现系统?我的第一次,虽然是有Web应用程序检查表SN列,有一个变量 lastProcessedSN 。并保持投票的每一分钟。是否有可能有DB通知Web应用程序时,有插入新行?

How do I implement the system? My first though is having web app check the table SN column, and have a variable lastProcessedSN. And keep polling every minute. Is it possible to have DB notify web app when there's a new row being inserted?

请指教,谢谢。





。编辑:
发送电子邮件只是一个例子,不是我想要做确切的事情。所以,这个问题的重点是如何实现的MSSQL表插入触发器调用我的程序。



Sending an email is just an example, not the exact thing I want to do. So this question is focusing on how to implement the trigger on MSSQL table insert to call my program.

推荐答案

您可以使用SqlDependency`看看

you could use SqlDependency`s see

的http:// www.codeproject.com/KB/database/chatter.aspx

&安培;

< A HREF =http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldependency.aspx相对=nofollow> http://msdn.microsoft.com/en-us/库/ system.data.sqlclient.sqldependency.aspx

这篇关于Web应用程序知道数据库更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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