hi friends
I used these codes for restoring my DB.But it has error.plz help me.
string backupfile = "D:\\Backup.bak";
Server svr = new Server(".");
Database db = new Database(svr, "library");
Restore rs = new Restore();
rs.NoRecovery = false;
rs.Database = "library";
rs.Action = RestoreActionType.Database;
BackupDeviceItem bdi = default(BackupDeviceItem);
bdi = new BackupDeviceItem(backupfile, DeviceType.File);
rs.Devices.Add(bdi);
rs.PercentCompleteNotification = 10;
rs.ReplaceDatabase = true;
* rs.SqlRestore(svr);
db.Refresh();
db.SetOnline();
svr.Refresh();
and the ERROR is:
Restore failed for Server 'My computer Name'
And the error is on line *.