Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

I currently have a process when a user clicks a button on the page the program fetches a file from via Ftp and then reads the file and inserts the data into a database table.

I would like to know how would I be able to let this process run automatically at a certain hour? lets say 12:05am daily
Posted
Comments
AnkitGoel.com 10-Dec-12 4:45am    
you have to write a job in sql server which calls a stored procedure and that stored procedure should download the file from ftp and insert the contents into database.

You can use the Windows Service which is designed for similar purposes and bundled with Windows; you can use it on different levels. It is called Window Task Scheduler, see http://en.wikipedia.org/wiki/Windows_Task_Scheduler[^].

First, you can schedule events using command-line utilities AT.EXE or CSHTASKS.EXE (which is replacing AT.EXE), see:
http://en.wikipedia.org/wiki/At_%28Windows%29[^],
http://en.wikipedia.org/wiki/Schtasks[^],
http://technet.microsoft.com/en-us/library/bb490866.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/bb736357%28v=vs.85%29.aspx[^].

And you also can use Window Task Scheduler API, please see:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383614%28v=vs.85%29.aspx[^],
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383608%28v=vs.85%29.aspx[^].

To see how can you use it with .NET, see this CodeProject article: A New Task Scheduler Class Library for .NET[^].

—SA
 
Share this answer
 
Comments
Abhinav S 11-Dec-12 0:43am    
5!
Sergey Alexandrovich Kryukov 11-Dec-12 0:47am    
Thank you, Abhinav.
--SA
You can create a scheduled task by using the CSTaskScheduler task[^].
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 11-Dec-12 0:47am    
Yes, a 5.
--SA
Abhinav S 11-Dec-12 0:52am    
Thank you SA.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900