⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmbackup.frm

📁 宾馆管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{74848F95-A02A-4286-AF0C-A3C755E4A5B3}#1.0#0"; "actskn43.ocx"
Begin VB.Form frmbackup 
   Caption         =   "数据备份/恢复"
   ClientHeight    =   5175
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8850
   LinkTopic       =   "Form1"
   ScaleHeight     =   5175
   ScaleWidth      =   8850
   StartUpPosition =   2  '屏幕中心
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   1680
      Top             =   4560
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   32
      ImageHeight     =   32
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   1
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmbackup.frx":0000
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin ACTIVESKINLibCtl.Skin sknbackup 
      Left            =   600
      OleObjectBlob   =   "frmbackup.frx":05F5
      Top             =   4680
   End
   Begin ACTIVESKINLibCtl.SkinLabel lblfile 
      Height          =   255
      Left            =   120
      OleObjectBlob   =   "frmbackup.frx":0829
      TabIndex        =   9
      Top             =   4080
      Width           =   8415
   End
   Begin VB.CommandButton cmdexit 
      Caption         =   "退出"
      Height          =   495
      Left            =   6720
      TabIndex        =   7
      Top             =   4560
      Width           =   1695
   End
   Begin VB.CommandButton cmdok 
      Caption         =   "确定"
      Height          =   495
      Left            =   4320
      TabIndex        =   6
      Top             =   4560
      Width           =   1695
   End
   Begin VB.Frame Frame2 
      Caption         =   "请选择路径"
      Height          =   3375
      Left            =   4080
      TabIndex        =   4
      Top             =   600
      Width           =   4575
      Begin VB.FileListBox File1 
         Height          =   1890
         Left            =   120
         Pattern         =   "*.BAK"
         TabIndex        =   11
         Top             =   1440
         Width           =   4215
      End
      Begin VB.DirListBox Dir1 
         Height          =   720
         Left            =   120
         TabIndex        =   10
         Top             =   600
         Width           =   4215
      End
      Begin VB.DriveListBox Drive1 
         Height          =   300
         Left            =   120
         TabIndex        =   5
         Top             =   240
         Width           =   4215
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "备份选项卡"
      Height          =   3375
      Left            =   0
      TabIndex        =   3
      Top             =   600
      Width           =   3855
      Begin MSComctlLib.ListView lvBack 
         Height          =   3015
         Left            =   120
         TabIndex        =   8
         Top             =   240
         Width           =   3615
         _ExtentX        =   6376
         _ExtentY        =   5318
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         _Version        =   393217
         Icons           =   "ImageList1"
         SmallIcons      =   "ImageList1"
         ColHdrIcons     =   "ImageList1"
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   1
         NumItems        =   1
         BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
            Object.Width           =   2540
         EndProperty
      End
   End
   Begin VB.OptionButton optrestore 
      Caption         =   "数据恢复"
      Height          =   255
      Left            =   6240
      TabIndex        =   2
      Top             =   120
      Width           =   1095
   End
   Begin VB.OptionButton optbackup 
      Caption         =   "数据备份"
      Height          =   255
      Left            =   4200
      TabIndex        =   1
      Top             =   120
      Width           =   1215
   End
   Begin ACTIVESKINLibCtl.SkinLabel SkinLabel1 
      Height          =   375
      Left            =   0
      OleObjectBlob   =   "frmbackup.frx":0887
      TabIndex        =   0
      Top             =   120
      Width           =   3375
   End
End
Attribute VB_Name = "frmbackup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim itmX As ListItem     '定义一个ListItem对象
Dim key, list, sql As String     '定义字符串变量
Dim a As Integer

Private Sub cmdexit_Click()
Unload Me
End Sub

Private Sub cmdok_Click()
Dim S As String
 If optbackup.Value = True Then
 '备份数据库
   S = Dir1.Path & "\" & Date & ".BAK"
   If lblfile.Caption = S Then
    MsgBox "数据备份卡已存在!"
   Else
    cnnHotel.Open "Provider=SQLOLEDB.1;User ID=sa;Data Source=(local);Initial Catalog=Master"
  '数据备份语句
    sql = "backup DATABASE DBHotel TO disk='" & S & "'"
    cnnHotel.Execute (sql)     '执行SQL语句
    cnnHotel.Close
    MsgBox "数据库备份成功!"
    key = Date & ".BAK"
    Set itmX = lvBack.ListItems.Add(, , key, 1)
   End If
 End If
 If optrestore.Value = True Then
'恢复指定路径下的数据库
  If File1.ListCount <> 0 Then
   If lblfile.Caption <> "" Then
     cnnHotel.Open "Provider=SQLOLEDB.1;User ID=sa;Data Source=(local);Initial Catalog=Master"
   '数据恢复语句
    sql = "RESTORE DATABASE DBHotel from disk='" & lblfile.Caption & "'"
    cnnHotel.Execute (sql)     '执行SQL语句
    cnnHotel.Close
    MsgBox "数据库恢复成功!"
   Else
    MsgBox "请选择要恢复的数据备份卡!"
   End If
  Else
   MsgBox "请选择要恢复的数据备份卡!"
  End If
 End If
End Sub


Private Sub Dir1_Change()
File1.Path = Dir1.Path
 '添加数据备份卡到列表中
 lvBack.ListItems.Clear
 If File1.ListCount <> 0 Then
  a = 0     '给变量a设置初值
  Do While File1.ListIndex < File1.ListCount - 1
    File1.ListIndex = a     '赋值给变量a
    key = File1.FileName
    Set itmX = lvBack.ListItems.Add(, , key, 1)
    a = a + 1
  Loop
 End If
 File1_Click
End Sub

Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub

Private Sub File1_Click()
 lblfile.Caption = Dir1.Path & "\" & File1.FileName
End Sub

Private Sub Form_Load()
 Call changeskin(Me, sknbackup, strSkin)
 optbackup.Value = True     '设置Option1的值为真
 Dir1_Change
 
 'Call KnowConnection
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -