Hi,
In my application i have to fetch data when today's date change. Data can automatically updated when today's date change. Please anyone can tell me how to do this.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
yogita dhingraPosted Jul 21, 2011, 2:36 AM
Jiteendra SampathiraoPosted Jul 21, 2011, 2:24 AM
using triggers concept is the best approach in this type of requirements...........
because At the end of the day means when day completes you want to fetch the data from database..so application server and database might be located in different places so. Do the activities in database side only the good option ...
so use triggers and get the retrieved values and use it in the application...........
Jaganathan BantheswaranPosted Jul 21, 2011, 2:10 AM
You need to have a timer which always checks for 12AM. if its equal then fetch the data.
for example,
private static System.Timers.Timer aTimer;
// Create a timer with a second interval.
aTimer = new System.Timers.Timer(1000);
// Hook up the Elapsed event for the timer.
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
// Set the Interval to 1 seconds (1000 milliseconds).
aTimer.Interval = 1000;
aTimer.Enabled = true;
In OnTimedEvent,
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
//do stuffs here
}