Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
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.
Posted
Updated 14-Nov-17 16:42pm
v2

1 solution

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.
 
Share this answer
 
Comments
Muthu Raman 15-Nov-17 13:00pm    
Hello Karthik, I am using LiteDB and i dont think ADO.Net is an option. I am already using it in Index.
I run the application now and i store few data elements using created and all the methods work on it. This happens only on that run.
Next time i run the webapp i want the already stored data from last run to be pass through the methods before i add anything new.
Karthik_Mahalingam 15-Nov-17 22:32pm    
Muthu Raman,
ok what ever might be the db, you shall store and retrieve the information rite.
store the last run information in some table and use it as reference and use it across on the future requests

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900