home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Internet Business Development Kit / PRODUCT_CD.iso / sqlsvr / alpha / backup.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-19  |  5.9 KB  |  194 lines

  1. VERSION 4.00
  2. Begin VB.Form Backup 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Database Backup"
  6.    ClientHeight    =   3570
  7.    ClientLeft      =   1830
  8.    ClientTop       =   3000
  9.    ClientWidth     =   5595
  10.    Height          =   3975
  11.    Left            =   1770
  12.    LinkTopic       =   "Form2"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   3570
  16.    ScaleWidth      =   5595
  17.    Top             =   2655
  18.    Width           =   5715
  19.    Begin Threed.SSCommand cClose 
  20.       Height          =   465
  21.       Left            =   2850
  22.       TabIndex        =   9
  23.       Top             =   2730
  24.       Width           =   1575
  25.       _version        =   65536
  26.       _extentx        =   2778
  27.       _extenty        =   820
  28.       _stockprops     =   78
  29.       caption         =   "&Close"
  30.       bevelwidth      =   1
  31.       outline         =   0   'False
  32.    End
  33.    Begin Threed.SSCommand cBackup 
  34.       Height          =   465
  35.       Left            =   1110
  36.       TabIndex        =   8
  37.       Top             =   2730
  38.       Width           =   1575
  39.       _version        =   65536
  40.       _extentx        =   2778
  41.       _extenty        =   820
  42.       _stockprops     =   78
  43.       caption         =   "&Backup"
  44.       bevelwidth      =   1
  45.       outline         =   0   'False
  46.    End
  47.    Begin Threed.SSCommand Command3 
  48.       Height          =   315
  49.       Left            =   4170
  50.       TabIndex        =   7
  51.       Top             =   180
  52.       Width           =   1215
  53.       _version        =   65536
  54.       _extentx        =   2143
  55.       _extenty        =   556
  56.       _stockprops     =   78
  57.       caption         =   "Contents"
  58.       bevelwidth      =   1
  59.       outline         =   0   'False
  60.    End
  61.    Begin Threed.SSCheck cInit 
  62.       Height          =   315
  63.       Left            =   1470
  64.       TabIndex        =   6
  65.       Top             =   1170
  66.       Width           =   2865
  67.       _version        =   65536
  68.       _extentx        =   5054
  69.       _extenty        =   556
  70.       _stockprops     =   78
  71.       caption         =   "Append Backup to Dump Device"
  72.       value           =   -1  'True
  73.    End
  74.    Begin VB.Label Label2 
  75.       BackColor       =   &H00C0C0C0&
  76.       Caption         =   "Databases:"
  77.       Height          =   285
  78.       Left            =   210
  79.       TabIndex        =   5
  80.       Top             =   630
  81.       Width           =   1275
  82.    End
  83.    Begin Threed.SSPanel SSPanel2 
  84.       Height          =   330
  85.       Left            =   1500
  86.       TabIndex        =   3
  87.       Top             =   600
  88.       Width           =   2625
  89.       _version        =   65536
  90.       _extentx        =   4630
  91.       _extenty        =   582
  92.       _stockprops     =   15
  93.       caption         =   "SSPanel1"
  94.       bevelouter      =   1
  95.       autosize        =   3
  96.       Begin VB.ComboBox dDatabases 
  97.          Height          =   300
  98.          Left            =   15
  99.          Style           =   2  'Dropdown List
  100.          TabIndex        =   4
  101.          Top             =   15
  102.          Width           =   2595
  103.       End
  104.    End
  105.    Begin VB.Label Label1 
  106.       BackColor       =   &H00C0C0C0&
  107.       Caption         =   "Dump Devices:"
  108.       Height          =   285
  109.       Left            =   210
  110.       TabIndex        =   2
  111.       Top             =   180
  112.       Width           =   1275
  113.    End
  114.    Begin Threed.SSPanel SSPanel1 
  115.       Height          =   330
  116.       Left            =   1530
  117.       TabIndex        =   0
  118.       Top             =   150
  119.       Width           =   2565
  120.       _version        =   65536
  121.       _extentx        =   4524
  122.       _extenty        =   582
  123.       _stockprops     =   15
  124.       caption         =   "SSPanel1"
  125.       bevelouter      =   1
  126.       autosize        =   3
  127.       Begin VB.ComboBox dDumpDevices 
  128.          Height          =   300
  129.          Left            =   15
  130.          Style           =   2  'Dropdown List
  131.          TabIndex        =   1
  132.          Top             =   15
  133.          Width           =   2535
  134.       End
  135.    End
  136. Attribute VB_Name = "Backup"
  137. Attribute VB_Creatable = False
  138. Attribute VB_Exposed = False
  139. Option Explicit
  140. Private Sub Command1_Click()
  141. End Sub
  142. Private Sub Command2_Click()
  143. End Sub
  144. Private Sub cBackup_Click()
  145. Dim MyBackup As New SQLOLE.Backup           ' create my backup Object
  146. MyBackup.DumpDevices = dDumpDevices.Text    'which device to dump to
  147. If cInit.Value = True Then                  'initialize DUMP device?
  148.     MyBackup.DumpInitDeviceBefore = 0
  149.     MyBackup.DumpInitDeviceBefore = 1
  150. End If
  151. MousePointer = 11
  152. On Error Resume Next
  153. OServer.Databases(dDatabases.Text).Dump MyBackup    ' DUMP it!
  154. If Err <> 0 Then
  155.           MsgBox Err.Description + " (Press F1 for Help)", 16, Err.Source & " Error", _
  156.           Err.HelpFile, Err.HelpContext
  157.           MousePointer = 0
  158.           Exit Sub
  159. End If
  160. On Error GoTo 0
  161. MousePointer = 0    ' all done
  162. End Sub
  163. Private Sub cClose_Click()
  164. Unload Backup
  165. End Sub
  166. Private Sub Command3_Click()
  167. CurrentDevice = dDumpDevices.Text
  168. DInfo.Show 1
  169. End Sub
  170. Private Sub Form_Load()
  171.   Dim MyDB As Object
  172.   For Each MyDB In OServer.Databases
  173.         ' always check that the database is accessable
  174.         ' (databases are inaccessible when being Loaded)
  175.         If MyDB.Status <> SQLOLEDBStat_Inaccessible Then
  176.             dDatabases.AddItem MyDB.Name
  177.             dDatabases.ListIndex = 0
  178.         Else
  179.             MsgBox "Database: """ + MyDB.Name + " "" is Inaccessible at this time ", 16, "Microsoft SQL Server"
  180.         End If
  181.   Next
  182.             
  183. ' List all DUMP devices on server
  184.   Dim MyDevice As SQLOLE.Device
  185.   For Each MyDevice In OServer.Devices
  186.     If MyDevice.Type = SQLOLEDevice_DiskDump Then  ' DUMP devices only
  187.      dDumpDevices.AddItem MyDevice.Name
  188.      dDumpDevices.ListIndex = 0
  189.     End If
  190.   Next
  191. End Sub
  192. Private Sub SSCommand2_Click()
  193. End Sub
  194.