简体   繁体   English

将新记录插入表中时在应用程序中显示消息

[英]Show message in application when new record inserted into the table

I am creating a web application using Dot net 3.5(c#). 我正在使用Dot net 3.5(c#)创建一个Web应用程序。

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. 看来您可以将SQLCacheDependency应用于您的问题。 You can compare is it fit to your requirements when read this article from ASP.NET website . 从ASP.NET网站阅读此文章时,您可以比较它是否符合您的要求。

Better approach is to use the SqlCacheDependency class so that data remains cached until its underlying data has been modified in the SQL database. 更好的方法是使用SqlCacheDependency类,以便在SQL数据库中修改其基础数据之前,数据一直保持缓存状态。 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. 您可以对SqlDependency等使用的Query Notifications基础结构尝试使用LinqToCache作为LINQ明智的包装器。 You can read this article to understand how SqlDependency works. 您可以阅读本文以了解SqlDependency的工作方式。

This will give you the active notifications mechanism for your web app to detect changes that occur on the database. 这将为您的Web应用程序提供活动的通知机制,以检测数据库上发生的更改。 For the popup part, there are well know methods using various Comet techniques. 对于弹出部分,有使用各种Comet技术的众所周知的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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