Click here to Skip to main content
11,642,216 members (61,428 online)
Rate this: bad
Please Sign up or sign in to vote.
how to make backup of sql server 2005 data through so that client side user can easily create own data backup. plz help me..its very urgent...
Posted 3-May-13 19:12pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can use SMO

Add these references:

'//***** Add these references**********

Add these Imports:

Imports System.Data.SqlClient
Imports Microsoft.SqlServer.Management.Smo
Imports Microsoft.SqlServer.Management.Common

Then code something like this:

Private Sub Backup
Dim srv As Server
Dim conn As ServerConnection
Dim sqlSErverInstance As String = "YourServerInstanceName"
Dim fileName As String = "MyBackup.bak"
Dim databaseName As String = "MyDatabase"
conn = New ServerConnection(sqlSErverInstance, "Username", "Password")
srv = New Server(conn)
Dim bkp As New Backup()
            bkp.Action = BackupActionType.Database
            bkp.Database = databaseName
            bkp.Devices.AddDevice(fileName, DeviceType.File)
            bkp.Incremental = False
            bkp.PercentCompleteNotification = 10
            AddHandler bkp.PercentComplete, AddressOf ProgressEventHandler

            MessageBox.Show("Database Backed Up To: " & fileName, "Backup")
        Catch ex As Exception
            Me.ProgressBar1.Value = 0
        End Try
End Sub
 Public Sub ProgressEventHandler(sender As Object, e As PercentCompleteEventArgs)
        Me.ProgressBar1.Value = e.Percent
 End Sub


Priyanka Jain at 4-May-13 1:40am
i didnot find these references. plz tell me from where i can get these reference?
Richard.Berry100 at 4-May-13 12:42pm
X86 Package (SharedManagementObjects.msi)


X64 Package (SharedManagementObjects.msi)

You can also try browsing to the actual dll - On my machine its:
C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\

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

  Print Answers RSS
0 DamithSL 240
1 Sergey Alexandrovich Kryukov 184
2 Afzaal Ahmad Zeeshan 139
3 OriginalGriff 135
4 Mika Wendelius 80
0 Mika Wendelius 460
1 DamithSL 443
2 OriginalGriff 340
3 Afzaal Ahmad Zeeshan 228
4 Sergey Alexandrovich Kryukov 179

Advertise | Privacy | Mobile
Web02 | 2.8.150731.1 | Last Updated 4 May 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