VERSION 4.00
Begin VB.Form Backup 
   BackColor       =   &H00C0C0C0&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Database Backup"
   ClientHeight    =   3570
   ClientLeft      =   1830
   ClientTop       =   3000
   ClientWidth     =   5595
   Height          =   3975
   Left            =   1770
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3570
   ScaleWidth      =   5595
   Top             =   2655
   Width           =   5715
   Begin Threed.SSCommand cClose 
      Height          =   465
      Left            =   2850
      TabIndex        =   9
      Top             =   2730
      Width           =   1575
      _version        =   65536
      _extentx        =   2778
      _extenty        =   820
      _stockprops     =   78
      caption         =   "&Close"
      bevelwidth      =   1
      outline         =   0   'False
   End
   Begin Threed.SSCommand cBackup 
      Height          =   465
      Left            =   1110
      TabIndex        =   8
      Top             =   2730
      Width           =   1575
      _version        =   65536
      _extentx        =   2778
      _extenty        =   820
      _stockprops     =   78
      caption         =   "&Backup"
      bevelwidth      =   1
      outline         =   0   'False
   End
   Begin Threed.SSCommand Command3 
      Height          =   315
      Left            =   4170
      TabIndex        =   7
      Top             =   180
      Width           =   1215
      _version        =   65536
      _extentx        =   2143
      _extenty        =   556
      _stockprops     =   78
      caption         =   "Contents"
      bevelwidth      =   1
      outline         =   0   'False
   End
   Begin Threed.SSCheck cInit 
      Height          =   315
      Left            =   1470
      TabIndex        =   6
      Top             =   1170
      Width           =   2865
      _version        =   65536
      _extentx        =   5054
      _extenty        =   556
      _stockprops     =   78
      caption         =   "Append Backup to Dump Device"
      value           =   -1  'True
   End
   Begin VB.Label Label2 
      BackColor       =   &H00C0C0C0&
      Caption         =   "Databases:"
      Height          =   285
      Left            =   210
      TabIndex        =   5
      Top             =   630
      Width           =   1275
   End
   Begin Threed.SSPanel SSPanel2 
      Height          =   330
      Left            =   1500
      TabIndex        =   3
      Top             =   600
      Width           =   2625
      _version        =   65536
      _extentx        =   4630
      _extenty        =   582
      _stockprops     =   15
      caption         =   "SSPanel1"
      bevelouter      =   1
      autosize        =   3
      Begin VB.ComboBox dDatabases 
         Height          =   300
         Left            =   15
         Style           =   2  'Dropdown List
         TabIndex        =   4
         Top             =   15
         Width           =   2595
      End
   End
   Begin VB.Label Label1 
      BackColor       =   &H00C0C0C0&
      Caption         =   "Dump Devices:"
      Height          =   285
      Left            =   210
      TabIndex        =   2
      Top             =   180
      Width           =   1275
   End
   Begin Threed.SSPanel SSPanel1 
      Height          =   330
      Left            =   1530
      TabIndex        =   0
      Top             =   150
      Width           =   2565
      _version        =   65536
      _extentx        =   4524
      _extenty        =   582
      _stockprops     =   15
      caption         =   "SSPanel1"
      bevelouter      =   1
      autosize        =   3
      Begin VB.ComboBox dDumpDevices 
         Height          =   300
         Left            =   15
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   15
         Width           =   2535
      End
   End
End
Attribute VB_Name = "Backup"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()

End Sub

Private Sub Command2_Click()
End Sub

Private Sub cBackup_Click()

Dim MyBackup As New SQLOLE.Backup           ' create my backup Object


MyBackup.DumpDevices = dDumpDevices.Text    'which device to dump to
If cInit.Value = True Then                  'initialize DUMP device?
    MyBackup.DumpInitDeviceBefore = 0
Else
    MyBackup.DumpInitDeviceBefore = 1
End If

MousePointer = 11
On Error Resume Next
OServer.Databases(dDatabases.Text).Dump MyBackup    ' DUMP it!

If Err <> 0 Then
          MsgBox Err.Description + " (Press F1 for Help)", 16, Err.Source & " Error", _
          Err.HelpFile, Err.HelpContext
          MousePointer = 0
          Exit Sub
End If
On Error GoTo 0

MousePointer = 0    ' all done

End Sub

Private Sub cClose_Click()
Unload Backup


End Sub

Private Sub Command3_Click()
CurrentDevice = dDumpDevices.Text

DInfo.Show 1

End Sub

Private Sub Form_Load()
  Dim MyDB As Object
  For Each MyDB In OServer.Databases
        ' always check that the database is accessable
        ' (databases are inaccessible when being Loaded)
        If MyDB.Status <> SQLOLEDBStat_Inaccessible Then
            dDatabases.AddItem MyDB.Name
            dDatabases.ListIndex = 0
        Else
            MsgBox "Database: """ + MyDB.Name + " "" is Inaccessible at this time ", 16, "Microsoft SQL Server"
    
        End If
  Next

            
' List all DUMP devices on server
  
  Dim MyDevice As SQLOLE.Device
  For Each MyDevice In OServer.Devices
    If MyDevice.Type = SQLOLEDevice_DiskDump Then  ' DUMP devices only
     dDumpDevices.AddItem MyDevice.Name
     dDumpDevices.ListIndex = 0
    End If
  Next

End Sub


Private Sub SSCommand2_Click()

End Sub


