Search code examples
c#sql-serversmo

Back failed for Server


http://www.daniweb.com/software-development/csharp/threads/202843/take-backup-of-sql-server-database-using-c

Error : Back failed for Server

I am using smo code from this thread , but it cant backup...

My Code :

    Server s = new Server(".\\SQLEXPRESS");
    Backup bk = new Backup();
    bk.Devices.AddDevice(backupText.Text, DeviceType.File);
    bk.Database = "System";
    bk.Action = BackupActionType.Database;
    bk.SqlBackup(s);

Solution

  • Problem was of permission.. For Connecting to sql server for taking backup backup permission is required. So Kindly Check permission section.