Click here to Skip to main content
11,702,168 members (63,440 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 Maciej Los 395
1 Sergey Alexandrovich Kryukov 355
2 OriginalGriff 314
3 CHill60 145
4 Mika Wendelius 119
0 OriginalGriff 8,344
1 Sergey Alexandrovich Kryukov 7,507
2 CPallini 4,922
3 Maciej Los 4,371
4 Mika Wendelius 3,556

Advertise | Privacy | Mobile
Web01 | 2.8.150819.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