如何使用c#为sql server 2008数据库安排备份(Windows应用程序)

问题描述:

我制作了一个桌面应用程序,我在其中进行了SQLSERVER 2008数据库备份以及手动恢复。



现在,我想制作一个应用程序可以预定这个备份。

喜欢DATE具体

还有DAILY(Time Spacific)



注意:这个是使用C#的Windows应用程序





请帮助我搞清楚。

I make one Desktop application in which I took SQLSERVER 2008 databse backup as well as restore it manually.

Now, I want to make one application by Which I can Scheduled this backup.
like DATE specific
and also DAILY (Time Spacific)

Noted: this is Windows Application Using C#


kindly Help me to figure it out.

创建一个Winform项目,

1)添加定时器控件。

2)在计时器Tick事件检查当前时间==你的首选时间例如

if(currentTime ==18:00:00)

{

doBackup;

}

3)在表单中加载启用计时器。

4)始终在服务器中运行程序。



你也可以使用SQL Job看看这个,不需要为此创建单独的程序。 http://blogs.msdn.com/b/sqlagent/archive/2010/10/12/create-a-database-backup-job-using-sql-server-management-studio.aspx
Hi,Create a Winform project,
1)Add Timer Control to it.
2)In timer Tick event check current time== your preferred time for example
if(currentTime=="18:00:00")
{
doBackup;
}
3) In form Load enable the Timer.
4) Always run your program in server.

You can also use SQL Job have a look at this no need to create separate program for this. http://blogs.msdn.com/b/sqlagent/archive/2010/10/12/create-a-database-backup-job-using-sql-server-management-studio.aspx


这是我从syed shanu得到的完美答案。







This is perfect Answer i got from syed shanu.



Hi,Create a Winform project,
1)Add Timer Control to it.
2)In timer Tick event check current time== your preferred time for example
if(currentTime=="18:00:00")
{
doBackup;
}
3) In form Load enable the Timer.
4) Always run your program in server.

You can also use SQL Job have a look at this no need to create separate program for this. http://blogs.msdn.com/b/sqlagent/archive/2010/10/12/create-a-database-backup-job-using-sql-server-management-studio.aspx


http://stackoverflow.com/questions/2348863/how-to-run-a-stored-procedure-in-sql-server-every-hour [ ^ ]



http://stackoverflow.com/questions/16187222/execute-the-script-itself-in-every-5-min-by-getting-the-system-time [ ^ ]



检查链接...希望你会得到他回答
http://stackoverflow.com/questions/2348863/how-to-run-a-stored-procedure-in-sql-server-every-hour[^]

http://stackoverflow.com/questions/16187222/execute-the-script-itself-in-every-5-min-by-getting-the-system-time[^]

Check the links...hope u will get the answer