Subject: Windows services in C#
Posted By: arielote Post Date: 12/24/2005 7:13:55 PM
Hi everybody!

Of course I am newbie in C#, but my boss asked me for an "piece of cake" application.
Here the problem:
1. I need to develop an application that runs as service, will be started, stopped, paused from control panel
2. This service will read OnStart some information from windows registry.
3. One of this info will the an especific hour when it has to do some task.
3. The service will be checking the actual time untill the specified hour in which has to make some task.
4. The tash is to login in an SQL2K database and move some records from a table to other, using an especific filter.

Could somebody send me some tips, and if possible some example code, about how to develop the service and where I have to call the module that will perform the tasks in the database.

Thank you very much and Merry Christmas

---
Ariel Folonier
San Nicolas
Argentina
Reply By: Imar Reply Date: 12/27/2005 5:13:10 PM
You can certainly do that; depending on your version of C# / Visual Studio, there should be a Windows Service template. That project type allows you to create an application that you can register in the Windows Services panel. Such an application can run in the background and listen to events.

One such event could come from a Timer object to allow you to run code at a specified interval.

Google has lots of results for "windows service" c#...

Maybe you shouldn't do this as a Windows Service, but directly in SQL Server. If you have simple logic, you could schedule a stored procedure. For more complex operations, you could use DTS and then schedule DTS packages.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.

Go to topic 37768

Return to index page 409
Return to index page 408
Return to index page 407
Return to index page 406
Return to index page 405
Return to index page 404
Return to index page 403
Return to index page 402
Return to index page 401
Return to index page 400