vielkacarolina1239
asked on
how to create a job schedule using C# in a console application?
Hi,
I am using C# in visual studio 2005
I need to create a console application that needs to run at 5:00 pm and run a process once per day. I have the following code. Please, see code snippet. however, this is looping all the time and kills the cpu. Please, how can I do the same thing but more efficient. How can I create a windows service that will run every day at 5:00pm and execute my process when is 5:00pm only?
Thanks.
I am using C# in visual studio 2005
I need to create a console application that needs to run at 5:00 pm and run a process once per day. I have the following code. Please, see code snippet. however, this is looping all the time and kills the cpu. Please, how can I do the same thing but more efficient. How can I create a windows service that will run every day at 5:00pm and execute my process when is 5:00pm only?
Thanks.
class Program
{
static void Main(string[] args)
{
while(true)
{
if (DateTime.Now.Hour == 17)
{
myMethod();
}
}
}
static void myMethod()
{
//do something
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if u try to solve it with code.. what happens when ur code crashes.. it wont run till u restart ur application