I would like to execute a storedprocedure for evey one hour and have to load the dataset in applicaion(dropdrown or some asp.net controle) by creating the timer in Global.asax file.
Am very very new for this kind of development, please any one could post the code or provide the exact flow what i have to do in coding and how to load the asp.net controls(dropdown or list controle).
Thank You in Advance,
Scheduling tasks like that is not an appropriate use for an aspx application.
However, there are several hacks/workarounds you can try:
http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc
http://www.west-wind.com/weblog/posts/2007/May/10/Forcing-an-ASPNET-Application-to-stay-alive
http://www.mikesdotnetting.com/Article/129/Simple-task-Scheduling-using-Global.asax
You would be much better off creating windows service or use the built-in Windows scheduler.
ASP.NET is the wrong tool for the job.
A web application is, by design, a request-response system. It listens for requests, processes those requests, and returns responses. Outside of that scope, it should be assumed that the application isn't running. (Indeed, IIS might shut down the application for any number of reasons, waking it again on the new request.)
What you want for a scheduled task is probably a Windows Service. This is designed to run in the background on the server. Including a timer is pretty straightforward and it can run tasks in response to that timer's tick event.
Thinking about it... What would the web application do when the timer ticks? How would it "load the data into some asp.net control" if it's executing a background-process and not actually responding to a web request? Without a page being requested, there is no page to show to the user.
The way I imagine this would work is that the Windows Service would be reading some data, running some business logic to transform that data, and writing the transformed data to another table or set of tables in the database. The web application would then just always refer to that other table or set of tables when it populates the controls on its pages. Essentially, the web application would have no knowledge of the back-end process that transforms the data. It just shows whatever the latest transformed data happens to be.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With