Windows Service or Scheduled Task  
Author Message
.net sukbir





PostPosted: Visual C# General, Windows Service or Scheduled Task Top

Dear All,

I need to run particular database script every 20 minutes. So what should I be doing I am confuse between windows service and scheduled task. Which is better



Visual C#3  
 
 
Gabriel Lozano-Moran





PostPosted: Visual C# General, Windows Service or Scheduled Task Top

Running it from within the DBMS is not an option

 
 
.net sukbir





PostPosted: Visual C# General, Windows Service or Scheduled Task Top

Dear Gabriel,

I dont have that option. So I need to make a separate script will run on 20 minutes intervals. So how can I do that


 
 
Peter Mourfield





PostPosted: Visual C# General, Windows Service or Scheduled Task Top

I would say that which is better depends on your scenario. Meaning if you only need to do this on one machine then a scheduled task is probably the right way to go. But, if this is something that needs to be deployed to many differeny machines, then a windows service would be easier.

Hope this helps!


 
 
.net sukbir





PostPosted: Visual C# General, Windows Service or Scheduled Task Top

Dear Gabriel,

I guess my choice wil be windos service cause I may later need to run this script on several different machines. Can you tell me where can I get a good reference to start off with my windows service application for my database script.


 
 
Gabriel Lozano-Moran





PostPosted: Visual C# General, Windows Service or Scheduled Task Top

Anyway if its only purpose is to run every 20 minutes the first thing I would think off is to use the task scheduler.

 
 
Gabriel Lozano-Moran





PostPosted: Visual C# General, Windows Service or Scheduled Task Top

Dear Gabriel,

I guess my choice wil be windos service cause I may later need to run this script on several different machines. Can you tell me where can I get a good reference to start off with my windows service application for my database script.

http://msdn2.microsoft.com/en-us/library/zt39148a(VS.80).aspx



 
 
.net sukbir





PostPosted: Visual C# General, Windows Service or Scheduled Task Top

Dear Gabriel,

So are you telling me to write a c# script and then put it as task scheduler to run it is it How can I write a database C# script But I guess windows service wil suit me better I guess. Please advice.


 
 
Gabriel Lozano-Moran





PostPosted: Visual C# General, Windows Service or Scheduled Task Top

Dear Gabriel,

So are you telling me to write a c# script and then put it as task scheduler to run it is it How can I write a database C# script But I guess windows service wil suit me better I guess. Please advice.

I was referring to VBScript (.vbs, .wsf). Just create a ConsoleApplication that does what you need and call that .exe every 20 mins. It is perfectly possible to create a Windows Service for this but if you need to run this on a single machine and you want some kind of User Interface that shows you the progress then you can't use a Windows Service.