Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 - DMO - MSSQL DATABASE BACKUP

Status
Not open for further replies.

muhaidib

Programmer
Sep 27, 2005
82
0
0
SA
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?
 
Stupid question.
but why do it via sqldmo?

Much easier to just execute this via a connection.

(I played with dmo a few years ago, but could never do things as easily as if I just sent the server a command.
With the exception being see a server that wasn't running.)

Rob


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top