简体   繁体   中英

Show message in application when new record inserted into the table

I am creating a web application using Dot net 3.5(c#).

Needs:

  1. One user is accessing the entry page(Updating the database)
  2. Another user is in report page. Once the table get updated i want to show popup message to indicate the user about the update in the database.

Is it possible to achieve this task. How to do this.

有可能,但是要做到这一点,您的报告页必须在计时器上使用ajax请求,以便与服务器核对是否有新记录。

It seems that you can apply SQLCacheDependency for your issue. You can compare is it fit to your requirements when read this article from ASP.NET website .

Better approach is to use the SqlCacheDependency class so that data remains cached until its underlying data has been modified in the SQL database. This tutorial shows you how.

You can try LinqToCache for a LINQ sensible wrapper around the Query Notifications infrastructure used by SqlDependency and the like. You can read this article to understand how SqlDependency works.

This will give you the active notifications mechanism for your web app to detect changes that occur on the database. For the popup part, there are well know methods using various Comet techniques.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM