闵行人力资源哪一家好:用ASP.NET来备份SQL数据库

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/02 16:34:22
用ASP.NET来备份SQL数据库

用SQL语句就可以了。

比如备份Northwind

SQL:
backup database Northwind to disk='c:\backuptext.dat'

所以程序这样写:

string myExecuteQuery = "backup database Northwind to disk='c:\backuptext.dat'";
SqlCommand myCommand = new SqlCommand(myExecuteQuery, myConnection);
myCommand.Connection.Open();
myCommand.ExecuteNonQuery();
myConnection.Close();