开发者

Database back up from mvc.net application

开发者 https://www.devze.com 2023-01-19 17:54 出处:网络
I am using VS2010 and working on mvc application. I want to get Database backup from c# code and then want to restore database开发者_开发技巧.

I am using VS2010 and working on mvc application. I want to get Database backup from c# code and then want to restore database开发者_开发技巧.

If some one has solution then please reply.


You can perform database backups using T-SQL script see this MSDN help page: http://msdn.microsoft.com/en-us/library/ms186865.aspx

Then you could wrap it as a Stored Procedure and execute it from your C# code.


You should think about your question as with two parts. First - Transact SQL script on how to backup and restore database, and second - how to run this script from ASP.Net, simply .NET for general purposes. Both are independent of each other. Answer of 1st question is as Sam adviced, look at MSDN Documentation. For the second sample, you could take a look at SqlCommand, using the first answer with it. For more general purposes, you could take a look at .NET Data Access, but i don't think you will need this one for now

0

精彩评论

暂无评论...
验证码 换一张
取 消