Click here to Skip to main content
15,921,622 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All
When i Resore .bak File that time Restore failed Error is show.. How to slove this ... Please Tell me..

Error is

Restore failed for Server 'XX-PC\SQLEXPRESS'.

Here i Use code for RESTORE

<pre lang="vb">Dim res As New Restore()

        Me.Cursor = Cursors.WaitCursor
        Me.DGV1.DataSource = String.Empty

    Dim fileName As String = Me.txtFileName.Text
    Dim databaseName As String = Me.ddlDatabase.SelectedItem.ToString()

        res.Database = databaseName
        res.Action = RestoreActionType.Database
        res.Devices.AddDevice(fileName, DeviceType.File)
        res.ReplaceDatabase = False
        res.NoRecovery = True
       res.PercentCompleteNotification = 10
      MessageBox.Show("Restore of " & databaseName & " Complete!", "Restore"

, MessageBoxButtons.OK, MessageBoxIcon.Information)
Idle_Force 20-Apr-13 21:13pm    
Did you Try/Catch your code and check the entire error for more info? Inner exception, stack trace, etc...
Navas Khanj 21-Apr-13 2:12am    
not try Catch
Dave Kreskowiak 21-Apr-13 10:17am    
It's impossible for anyone to help you becuase the "Restore" class is not a .NET class or a mamber of any library I'm familiar with. Without seeing what that Restore class code is doing and the exact error message it's throwing, it's impossible to help.

If this is a 3rd party library you're using, youre best source of information about how to use it would be the people who wrote it.

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