Error : *"Restore failed for Server '\.\pipe\81DAC374-2583-49\tsql\query'."*
i get the error here resDB.SqlRestore(sv)
My backup works fine but restore fails.i am trying to get it working from the past two days and no luck yet.
Public Shared Sub RestoreBackup()
Dim sConnect As String = My.Settings.LICConnectionString
Dim dbName As String
Using cnn As New SqlConnection(sConnect)
cnn.Open()
dbName = cnn.Database.ToString()
cnn.ChangeDatabase("master")
Dim sc As New ServerConnection(cnn)
Dim sv As New Server(sc)
' Check that I'm connected to the user instance
MsgBox(sv.InstanceName.ToString())
' Create backup device item for the backup
Dim bdi As New BackupDeviceItem("C:\Backup\LIC.bak", DeviceType.File)
' Create the restore object
Dim resDB As New Restore()
resDB.Devices.Add(bdi)
resDB.NoRecovery = False
resDB.ReplaceDatabase = True
resDB.Database = dbName
' Restore the database
resDB.SqlRestore(sv)
MsgBox("Your database has been restored.")
End Using
End Sub
Why does it fail??Any Help Appreciated.