Click here to Skip to main content
13,042,630 members (77,115 online)
Rate this:
Please Sign up or sign in to vote.
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)
Posted 20-Apr-13 8:49am
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 20 Apr 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100