lucky daj

lucky daj

  • NA
  • 1
  • 2.1k

Problem In Restoring DB

Aug 29 2009 12:50 AM
Hi Friends I Used These Codes for restoring my DataBase.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'" the error is on line *.