To create backup thru VB6 I am using following code and facing problem.
Dim BACKUP As New SQLDMO.Backup2
Dim SERVER As New SQLDMO.SQLServer2
Private Sub Command3_Click()
On Error Resume Next
Dim oDevice As New SQLDMO.BackupDevice
With oDevice
.Type = SQLDMODevice_DiskDump
.Name = "ICNOR08DBakUp"
.PhysicalLocation = "C:\share\BACKUP.bak"
End With
SERVER.Connect "ACC-SQL", "sa", "123"
SERVER.BackupDevices.Add oDevice
BACKUP.Action = SQLDMOBackup_Database
BACKUP.Database = "ICNOR08D"
BACKUP.Devices = "ICNOR08DBakUp"
BACKUP.BackupSetDescription = "Full BackUp"
BACKUP.BackupSetName = "By Rashid"
Call BACKUP.SQLBackup(SERVER)
End Sub
My problem is that the code runs well but does not generate desired .bak file.
Where I am making mistake?
Dim BACKUP As New SQLDMO.Backup2
Dim SERVER As New SQLDMO.SQLServer2
Private Sub Command3_Click()
On Error Resume Next
Dim oDevice As New SQLDMO.BackupDevice
With oDevice
.Type = SQLDMODevice_DiskDump
.Name = "ICNOR08DBakUp"
.PhysicalLocation = "C:\share\BACKUP.bak"
End With
SERVER.Connect "ACC-SQL", "sa", "123"
SERVER.BackupDevices.Add oDevice
BACKUP.Action = SQLDMOBackup_Database
BACKUP.Database = "ICNOR08D"
BACKUP.Devices = "ICNOR08DBakUp"
BACKUP.BackupSetDescription = "Full BackUp"
BACKUP.BackupSetName = "By Rashid"
Call BACKUP.SQLBackup(SERVER)
End Sub
My problem is that the code runs well but does not generate desired .bak file.
Where I am making mistake?