Show message in application when new record inserted into the table
I am creating a 开发者_开发百科web application using Dot net 3.5(c#).
Needs:
- One user is accessing the entry page(Updating the database)
- 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.
It's possible, but to do it your report page has to use ajax requests on a timer to check with the server for new records.
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.
精彩评论