Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello everyone
I am using a code written in C# for downloading backup of my sqlserver database.That code uses SMO object etc to download the backup.I am pasting my code below :

C#
Backup backup = new Backup();
backup.Action = BackupActionType.Database;
backup.BackupSetDescription = "BackupDataBase description";
backup.BackupSetName = "megha";
backup.Database = "rukmini";
BackupDeviceItem deviceItem = new BackupDeviceItem(
                                backupDestinationFilePath,
                                DeviceType.File);
backup.Devices.Add(deviceItem);
ServerConnection connection = new ServerConnection(@"PHYZER-PCS");
connection.LoginSecure = false;
connection.Login = "sa";
connection.Password = "phyzer1234";
Server sqlServer = new Server(connection);
backup.Initialize = true;
backup.Checksum = true;
backup.ContinueAfterError = true;
backup.ExpirationDate = DateTime.Now.AddDays(3);
backup.LogTruncation = BackupTruncateLogType.Truncate;
backup.SqlBackup(sqlServer);


The above code works well for me still on local iis(i.e on my system) and also it works fine some days ago on remote server.But it has stopped working now for remote server.I don't know why.The sqlserver version is 2008.
Pls help me.
Posted
Updated 30-Jul-13 18:30pm
v3
Comments
Dholakiya Ankit 29-Jul-13 7:04am    
what u changed in somedays analys it..(:)
walterhevedeich 31-Jul-13 1:34am    
Try checking Event Viewer and SQL Server logs for errors. It might help you in troubleshooting the issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900