当SQL从Web窗体应用程序插入新行时,C#Winforms通知 [英] C# Winforms notification when SQL has new row inserted from a Web Forms Application

查看:85
本文介绍了当SQL从Web窗体应用程序插入新行时,C#Winforms通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我设法创建了一个Web应用程序,将一些记录插入到我的服务器上,并在Windows窗体应用程序上读取记录另一端。



每当我从网络应用程序插入新记录时,我想为我的Windows窗体创建一个通知。



如何处理它?<​​br />


我在尝试使用SqlDependency时遇到问题,因为我使用了2个应用程序来处理记录。



谢谢

Hi,

I''ve managed to create a web application to insert some records to my server, and read the records on a windows forms application on the other end.

I would like to create a notification for my windows forms everytime I new record has been inserted from the web application.

How am I going to deal with it?

I am having problem trying out the SqlDependency since I used 2 application for manipulating records.

Thanks

推荐答案

此类操作的最佳做​​法是发布者 - 订阅者模式。在这种情况下,基本上只要插入成功就会引发事件,并且每当事件发生时都会通知所有订户。您可以在发布/订阅 [ ^ ]
Best practice for this kind of operations is publisher-subscriber pattern. In this situation basically you will raise an event whenever the insert is successful and all the subscriber will be notified whenever the event occurs. You can read about this more at Publish/Subscribe[^]


这篇关于当SQL从Web窗体应用程序插入新行时,C#Winforms通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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