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

📄 frmbf.frm

📁 本系统实现了对实验室设备的增删改查等基本的功能
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmbf 
   BackColor       =   &H80000003&
   Caption         =   "数据备份与恢复"
   ClientHeight    =   4935
   ClientLeft      =   4125
   ClientTop       =   2340
   ClientWidth     =   6660
   Icon            =   "frmbf.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   4935
   ScaleWidth      =   6660
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton Command2 
      BackColor       =   &H00FFC0C0&
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3720
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   4440
      Width           =   1695
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00FFC0C0&
      Caption         =   "数据备份或恢复"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1560
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   4440
      Width           =   1695
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00C0C0FF&
      Caption         =   "数据备份与恢复"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   4215
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   6375
      Begin VB.FileListBox File1 
         Height          =   2250
         Left            =   2880
         TabIndex        =   7
         Top             =   1680
         Width           =   3255
      End
      Begin VB.DriveListBox Drive1 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   360
         TabIndex        =   4
         Top             =   1680
         Width           =   2295
      End
      Begin VB.DirListBox Dir1 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1770
         Left            =   360
         TabIndex        =   3
         Top             =   2160
         Width           =   2295
      End
      Begin VB.OptionButton Opt2 
         BackColor       =   &H00C0C0FF&
         Caption         =   "数据恢复"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   375
         Left            =   2760
         TabIndex        =   2
         Top             =   240
         Width           =   2535
      End
      Begin VB.OptionButton Opt1 
         BackColor       =   &H00C0C0FF&
         Caption         =   "数据备份"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   375
         Left            =   360
         TabIndex        =   1
         Top             =   240
         Width           =   1935
      End
      Begin VB.Label Label2 
         BackColor       =   &H00C0C0FF&
         Caption         =   "请选择备份或恢复路径"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00FF0000&
         Height          =   375
         Left            =   360
         TabIndex        =   9
         Top             =   720
         Width           =   2415
      End
      Begin VB.Label Label1 
         BackColor       =   &H00C0C0FF&
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   375
         Left            =   360
         TabIndex        =   8
         Top             =   1200
         Width           =   5895
      End
   End
End
Attribute VB_Name = "frmbf"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*********************************************
'模块名称:数据备份与恢复
'模块功能:完成数据库备份与恢复
'版本    :1.0版
'代码编写者:熊锋
'编写日期:2006-11-6
'*********************************************
'数据备份和恢复
Private Sub Command1_Click()
   Dim s As String
   Dim ws As Workspace
   Dim db As Database
   Dim msgtext As String
   s = Dir1.Path & "\" & Date & ".BAK"
   If Opt1.Value = False And Opt2.Value = False Then
       MsgBox "请选择需要的操作"
       Exit Sub
   End If
   '数据备份
   If Opt1.Value = True Then
       SQL = "backup DATABASE SYSGLXT TO disk='" & s & "'"
       DBCnn.Execute (SQL)     '执行SQL语句
       DBCnn.Close
         '完成事务日志的填写
               rslog.Open "select * from Log_Info where 操作员=''", DBCnn, adOpenStatic, adLockOptimistic
               rslog.AddNew
               rslog.Fields("操作员") = frmlog.txtuser.Text
               rslog.Fields("日期") = Date
               rslog.Fields("操作时间") = Time
               rslog.Fields("操作模块") = "数据备份与恢复界面"
               rslog.Fields("操作") = "数据备份"
               rslog.Update
               rslog.Close
       MsgBox "数据库备份成功!", , "提示窗口"
   ElseIf Opt2.Value = True Then
       '数据恢复
       SQL = "RESTORE DATABASE SYSGLXT from disk='" & Label1.Caption & "'"
           Set cnn = New ADODB.Connection
           cnn.Open "driver=SQL Server;server=;uid=;pwd="
           cnn.Execute SQL
           On Error Resume Next
           If Err <> 0 Then
               MsgBox "错误:" & Err.Descripting
           Else
               MsgBox "数据恢复成功!"
                '完成事务日志的填写
               rslog.Open "select * from Log_Info where 操作员=''", DBCnn, adOpenStatic, adLockOptimistic
               rslog.AddNew
               rslog.Fields("操作员") = frmlog.txtuser.Text
               rslog.Fields("日期") = Date
               rslog.Fields("操作时间") = Time
               rslog.Fields("操作模块") = "数据备份与恢复界面"
               rslog.Fields("操作") = "数据恢复"
               rslog.Update
               rslog.Close
           End If
   End If
End Sub

Private Sub Command2_Click()
   Unload Me
End Sub
'目录列表矿变化时,将文件列表矿的path属性相应变化
Private Sub Dir1_Change()
   File1.Path = Dir1.Path
   Label1.Caption = Dir1.Path
End Sub
'驱动器列表框中驱动器变化时,将目录列表框的path属性相应变化
Private Sub Drive1_Change()
   Dir1.Path = Drive1.Drive
   Label1.Caption = Drive1.Drive
End Sub
'在文件列表矿中单击文件时,用label1获取文件路径
Private Sub File1_Click()
  Label1.Caption = Dir1.Path & "\" & File1.FileName
End Sub


⌨️ 快捷键说明

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