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.
Fetch data when today's date change
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Jul 20, 2011, 10:10 PM EDT
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
}
Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Jul 20, 2011, 10:24 PM EDT
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...........
yogita dhingra31 reputationPosted Jul 20, 2011, 10:36 PM EDT