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

📄 frm_bfyhf.frm

📁 是一款专业的销售管理软件
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Frm_bfyhf 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "数据库备份与恢复"
   ClientHeight    =   3870
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6930
   Icon            =   "Frm_bfyhf.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3870
   ScaleWidth      =   6930
   StartUpPosition =   2  '屏幕中心
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   420
      Left            =   165
      Top             =   4110
      Width           =   1620
      _ExtentX        =   2858
      _ExtentY        =   741
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton Cmd_Exit 
      Caption         =   "关闭退出"
      Height          =   350
      Left            =   5520
      TabIndex        =   9
      Top             =   3030
      Width           =   1050
   End
   Begin MSComctlLib.ProgressBar ProgressBar1 
      Height          =   360
      Left            =   0
      TabIndex        =   8
      Top             =   3510
      Width           =   6855
      _ExtentX        =   12091
      _ExtentY        =   635
      _Version        =   393216
      Appearance      =   1
   End
   Begin VB.TextBox Text2 
      Height          =   1335
      Left            =   2910
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   7
      ToolTipText     =   "数据恢复的文件"
      Top             =   1560
      Width           =   3825
   End
   Begin VB.TextBox Text1 
      Height          =   1335
      Left            =   2910
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   6
      ToolTipText     =   "数据库备份路径"
      Top             =   150
      Width           =   3825
   End
   Begin VB.FileListBox File1 
      Height          =   1890
      Left            =   105
      TabIndex        =   5
      Top             =   1440
      Width           =   2595
   End
   Begin VB.DirListBox Dir1 
      Height          =   930
      Left            =   120
      TabIndex        =   4
      Top             =   495
      Width           =   2595
   End
   Begin VB.DriveListBox Drive1 
      Height          =   300
      Left            =   120
      TabIndex        =   3
      Top             =   135
      Width           =   2595
   End
   Begin VB.CommandButton cmd_Restore 
      Caption         =   "数据恢复"
      Height          =   350
      Left            =   4275
      TabIndex        =   1
      Top             =   3030
      Width           =   1050
   End
   Begin VB.CommandButton cmd_Back 
      Caption         =   "数据备份"
      Height          =   350
      Left            =   3060
      TabIndex        =   0
      Top             =   3030
      Width           =   1050
   End
   Begin MSComctlLib.StatusBar StatusBar1 
      Align           =   1  'Align Top
      Height          =   3465
      Left            =   0
      TabIndex        =   2
      Top             =   0
      Width           =   6930
      _ExtentX        =   12224
      _ExtentY        =   6112
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   2
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   4939
            MinWidth        =   4939
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   7056
            MinWidth        =   7056
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "Frm_bfyhf"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As New ADODB.Recordset
Private sql As String
Dim workarea(12) As String
Dim StrCnn  As ADODB.Connection

Private Sub cmd_Back_Click()  '数据备份
  cmd_Back.Enabled = False
  cmd_Restore.Enabled = False
  Cmd_Exit.Enabled = False
  Dim Myfile As String
  Myfile = Text1.Text & "\" & Format(Date, "YYYY-MM-DD") & ":" & Format(Time, "hh") & ".BAK"
  Set rs = New ADODB.Recordset
  ProgressBar1.Visible = True
  ProgressBar1.Max = UBound(workarea)
  ProgressBar1.Value = ProgressBar1.Min
  For counter = LBound(workarea) To UBound(workarea)
      workarea(counter) = "initial value" & counter
      ProgressBar1.Value = counter
      sql = "BACKUP DATABASE db_SPJXC TO DISK ='" & Myfile & " '"
      Set rs = ESQL(sql)
  Next counter
  ProgressBar1.Value = ProgressBar1.Min
  MsgBox "数据库备份成功!", vbInformation, "提示信息"
  cmd_Back.Enabled = True
  cmd_Restore.Enabled = True
  Cmd_Exit.Enabled = True
End Sub

Private Sub Cmd_Exit_Click()
  Unload Me
  Shell App.Path & "\进销存管理系统.exe", vbNormalFocus
End Sub

Private Sub cmd_Restore_Click()
 cmd_Back.Enabled = False
 cmd_Restore.Enabled = False
 Cmd_Exit.Enabled = False
On Error GoTo ResErr
Dim counter As Integer
ProgressBar1.Max = UBound(workarea)
ProgressBar1.Value = ProgressBar1.Min
  For counter = LBound(workarea) To UBound(workarea)
      workarea(counter) = "initial value" & counter
      ProgressBar1.Value = counter
          Set StrCnn = New ADODB.Connection
          StrCnn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=master"
          sql = "use master RESTORE DATABASE db_SPJXC from disk='" & Text2.Text & "'"
          StrCnn.Execute (sql)     '执行SQL语句
          StrCnn.Close
  Next counter
  ProgressBar1.Value = ProgressBar1.Min
     MsgBox "数据库恢复成功!!", 64, "提示信息"
     cmd_Back.Enabled = True
     cmd_Restore.Enabled = True
     Cmd_Exit.Enabled = True
  Exit Sub
ResErr:
  MsgBox "由于系统数据量大,数据库恢复已经超时,请退出系统重新操作数据备份!!!", , "提示信息"
  cmd_Back.Enabled = True
  cmd_Restore.Enabled = True
  Cmd_Exit.Enabled = True
  End
End Sub

Private Sub Dir1_Change()
  File1.Path = Dir1.Path
End Sub

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

Private Sub File1_Click()
  If Mid(File1.FileName, 14, 17) <> ".BAK" Then
     MsgBox "请您选择扩展名为‘.BAK’的文件为合法文件", vbInformation, "提示信息"
     
     Exit Sub
  End If
  Text2.Text = Dir1.Path & "\" & File1.FileName
End Sub

Private Sub Form_Load()
Cmd_Exit.Enabled = True
End Sub

⌨️ 快捷键说明

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