每次在ASP.NET MVC中运行网站时,如何在数据库中传递已存储的数据? [英] How to pass already stored data in the database each time the website is run in ASP.NET MVC?

查看:101
本文介绍了每次在ASP.NET MVC中运行网站时,如何在数据库中传递已存储的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次在ASP.net MVC中运行网站时,如何在数据库中传递已存储的数据?

我有一个带方法的控制器,我希望每次运行应用程序时都要对已存储的数据执行。



< b>我尝试了什么:



还有什么方法可以改变这种存储的数据及时传递到控制器方式。假设我希望这个存储的数据每隔五分钟传递到控制器中的方法一次。

解决方案

每次在ASP.net MVC中运行网站时,如何将已存储的数据传递到数据库中?



使用

ADO.NET [ ^ ](或)

LINQ to SQL | Microsoft Docs [ ^ ](或)

每次在ASP.NET MVC中运行网站时,如何在数据库中传递已存储的数据? [ ^ ]

参考这个例子, Asp .Net MVC使用ADO.NET从数据库获取(显示)数据 [ ^ ]



我希望它被执行f或者每次运行应用程序时已存储的数据。



在应用程序的起始页面添加代码,例如( Home 控制器,索引行动)



还有任何方法可以改变这种存储的数据及时传递到控制器的方式。假设我希望这个存储的数据每五分钟传递到控制器中的方法一次



但是操作将从视图页面触发,因此您应该每隔5点击中一次控制器分钟使用 Ajax Call [ ^ ]和 Window setInterval()方法 [ ^ ]并从数据库中获取最新数据使用上述方法中的任何一种。


How to pass already stored data in the database each time the website is run in ASP.net MVC??
I have a controller with methods, i want it to be executed for the already stored data each time i run the application.

What I have tried:

Also is there any way to change in such a way that this stored data get passed into the controller in a timely manner. Say i want this stored data to be passed into the methods in controller every five minutes once.

解决方案

How to pass already stored data in the database each time the website is run in ASP.net MVC??


use
ADO.NET[^] (or)
LINQ to SQL | Microsoft Docs[^] (or)
How to pass already stored data in the database each time the website is run in ASP.NET MVC?[^]
refer this example, Asp.Net MVC Get (Display) Data from Database using ADO.NET [^]


i want it to be executed for the already stored data each time i run the application.


Add your code in the starting page of the application eg (Home Controller, Index Action)


Also is there any way to change in such a way that this stored data get passed into the controller in a timely manner. Say i want this stored data to be passed into the methods in controller every five minutes once


However the action will be triggered from the view page, so you shall hit the controller for every 5 minutes using Ajax Call[^] and Window setInterval() Method[^] and get the latest data from the db using anyone of the above methods.


这篇关于每次在ASP.NET MVC中运行网站时,如何在数据库中传递已存储的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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