Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: VB.NET
Please help! I tried but cannot solve.
Here is the code I use is following:
Imports System.Data.SqlClient
Imports Microsoft.SqlServer.Management.Smo
Imports Microsoft.SqlServer.Management
Imports Microsoft.SqlServer.Management.Common
Imports Microsoft.SqlServer.Management.Sdk.Sfc
Imports System.Configuration
Dim db As String = ""
    Dim dbname As String = ""
    Dim con As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\LandandBuildingProject\LandandBuildingProject\Building.mdf;Integrated Security=True;User Instance=True")
    Dim sqlserver As New Server(New ServerConnection(con))
    Dim WithEvents backup As New Backup
    Dim WithEvents restore As New Restore
    Sub dbrestore()
         If con.State = ConnectionState.Closed Then
        End If
        Dim dbrest As New DatabaseUserAccess
        dbrest = DatabaseUserAccess.Single

        db = ((ComboBox1.SelectedItem)).ToString
        restore.Database = db
        Dim device As New BackupDeviceItem(Openbakfile.FileName, DeviceType.File)
        restore.Action = RestoreActionType.Database
        ProgressBar2.Value = 0
        restore.PercentCompleteNotification = 10
        restore.SqlRestore(sqlserver)// error here
        dbrest = DatabaseUserAccess.Multiple
    End Sub
i get error of restore fail for server and Affinity Info = {"Failed to retrieve data for this request
Posted 13-Feb-13 5:07am
Edited 13-Feb-13 6:34am
priyanshbhaliya at 14-Feb-13 8:15am
Plz some one as fast.....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Zoltán Zörgő 265
1 /\jmot 205
2 CHill60 145
3 Peter Leow 145
4 CPallini 135
0 Sergey Alexandrovich Kryukov 9,363
1 OriginalGriff 6,881
2 Peter Leow 4,577
3 Zoltán Zörgő 4,184
4 CHill60 2,892

Advertise | Privacy | Mobile
Web03 | 2.8.150129.1 | Last Updated 13 Feb 2013
Copyright © CodeProject, 1999-2015
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