简体   繁体   English

在 ASP.NET webforms 前端自动加载新插入的行(SQL Server 数据库)?

[英]Automatically load newly inserted rows (SQL Server database) in ASP.NET webforms front-end?

I have a SQL Server database with one table and I am doing operations using Entity Framework 6 in C#.我有一个带有一张表的 SQL 服务器数据库,我正在 C# 中使用 Entity Framework 6 进行操作。

I have a jQuery in my frontend which calls a method in the C# backend and loads the data from the database using Entity Framework.我的前端有一个 jQuery,它调用 C# 后端中的一个方法,并使用 Entity Framework 从数据库加载数据。

Now I want to invoke this method automatically as soon my table in database gets any new rows / data.现在我想在数据库中的表获取任何新行/数据时自动调用此方法。

I don't want to use SignalR, wants to keep it simple as possible.我不想使用 SignalR,希望尽可能简单。

I am still figuring out the best possible and easiest way to do this.我仍在寻找最好和最简单的方法来做到这一点。 If I add a trigger on my table in SQL Server, then how it will invoke my jQuery method or C# method?如果我在 SQL 服务器的表上添加触发器,那么它将如何调用我的 jQuery 方法或 C# 方法?

If I add a trigger on my table in SQL Server, then how it will invoke my jQuery method or C# method?如果我在 SQL 服务器的表上添加触发器,那么它将如何调用我的 jQuery 方法或 C# 方法?

It can't, at least not directly, without implementing something poorly like a CLR procedure that then invokes your application.它不能,至少不能直接实现,除非实现一些糟糕的东西,比如 CLR 过程,然后调用您的应用程序。

You can look into Query Notifications to potentially accomplish your goals in a more vanilla way, but be warned, you'll probably be the only person in existence actively using this feature:您可以查看查询通知以更普通的方式实现您的目标,但请注意,您可能是唯一一个积极使用此功能的人:

Built upon the Service Broker infrastructure, query notifications allow applications to be notified when data has changed.查询通知建立在 Service Broker 基础设施之上,允许应用程序在数据发生变化时得到通知。 This feature is particularly useful for applications that provide a cache of information from a database, such as a Web application, and need to be notified when the source data is changed.此功能对于提供数据库信息缓存的应用程序特别有用,例如 Web 应用程序,并且需要在源数据更改时得到通知。

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

相关问题 从SQL Server数据库更新前端WPF应用 - Updating front-end WPF app from a SQL Server database 使用后端SQL数据库在ASP.NET Webforms网站上存储和显示图像 - Storing and displaying images on a ASP.NET Webforms website with back end SQL database 应该在 asp.net 项目的前端或后端进行登录 - should sign in occur in the front-end or the back-end of an asp.net project 如何从 asp.net 网络表单中的数据库动态加载路由 - how to load routes dynamically from database in asp.net webforms 如何使用ASP.NET WebForms和现有SQL Server数据库实现登录功能? - How to implement Login functionality using ASP.NET WebForms and existing SQL Server database? 在 ASP.NET Web 窗体中从后面的代码创建 html 元素并显示到前端 - Create html elements from code behind and display to front-end in ASP.NET Web Form ASP.NET Core SPA中基于JWT的身份验证-前端验证 - JWT-based authentication in ASP.NET Core SPA - front-end validation 使用WebForms的ASP.Net Identity到现有SQL数据库 - ASP.Net Identity with WebForms to existing SQL database C#控制台应用程序的ASP.net与Basic Web前端 - ASP.net vs Basic web front-end for C# Console App 未使用ASP.NET WebService将值插入SQL Server DB中 - Values not inserted in SQL Server DB using ASP.NET WebService
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM