How to do SQL Server database back up and recovery in MVC 4

3.3k views Asked by At

I want to do a backup of my SQL Server database via my program in ASP.Net MVC 4. Please help me on where to start as I have not done it before.

Thanks in advance

2

There are 2 answers

0
udaya726 On

you can use Microsoft.SqlServer.Management.Smo for back up and restore database Code Project example using .Net 2.0 .Hope this will match your requirement

Also look the same type of question Restore SQL Database using C#

0
Edi Wang On

backup is simple, you can execute sql command in entity framework:

BACKUP DATABASE YourDB TO DISK = 'C:\Backups\YourDB.bak'