Click here to Skip to main content
11,927,378 members (49,984 online)
Rate this:
Please Sign up or sign in to vote.
See more: SQL-server-2005 VB SQL-Server , +
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 20: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 4-May-13 1:40am
i didnot find these references. plz tell me from where i can get these reference?
Richard.Berry100 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\
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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
Web02 | 2.8.151126.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