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

📄 frm_backrestore.frm

📁 大型客户管理系统,分为基础信息模块、客户信息模块、客户服务模块、信息查询模块、数据管理模块、辅助工具模块、系统管理模块 数据库SQL
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form Frm_BackRestore 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "数据库备份与恢复"
   ClientHeight    =   3930
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6930
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3930
   ScaleWidth      =   6930
   StartUpPosition =   2  '屏幕中心
   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_BackRestore"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private rs As New ADODB.Recordset
Private Rs_user As New ADODB.Recordset
Private sql As String
Dim workarea(12) As String
Dim StrCnn As New Connection
Private Sub cmd_Back_Click()  '数据备份
  cmd_Back.Enabled = False
  cmd_Restore.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_Client TO DISK ='" & Myfile & " '"
      Set rs = ESQL(sql)
  Next counter
  ProgressBar1.Value = ProgressBar1.Min
  MsgBox "数据库备份成功!"
  cmd_Back.Enabled = True
  cmd_Restore.Enabled = True
End Sub

Private Sub Cmd_Exit_Click()
  Unload Me
End Sub

Private Sub cmd_Restore_Click()
 cmd_Back.Enabled = False
 cmd_Restore.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
         StrCnn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=master"
          sql = "use master RESTORE DATABASE db_Client 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
  Exit Sub
ResErr:
  MsgBox "由于系统数据量大,数据库恢复已经超时,请退出系统重新操作数据备份!!!", , "系统提示"
  cmd_Back.Enabled = True
  cmd_Restore.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’的文件为合法文件"
     Exit Sub
  End If
  Text2.Text = Dir1.Path & "\" & File1.FileName
End Sub

⌨️ 快捷键说明

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