📄 数据库.frm
字号:
VERSION 5.00
Begin VB.Form shujuku
Caption = "数据库管理"
ClientHeight = 3270
ClientLeft = 60
ClientTop = 450
ClientWidth = 4830
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3270
ScaleWidth = 4830
StartUpPosition = 3 '窗口缺省
Begin VB.Frame DB_Restore
Caption = "数据库恢复"
Height = 3015
Left = 120
TabIndex = 7
Top = 120
Width = 4575
Begin VB.CommandButton cmdCancelRestore
Caption = "取消恢复"
Height = 375
Left = 960
TabIndex = 13
Top = 2280
Width = 1095
End
Begin VB.ComboBox RestoreName
Height = 300
Left = 1320
Style = 2 'Dropdown List
TabIndex = 12
Top = 1080
Width = 2655
End
Begin VB.CommandButton cmdBeginRestore
Caption = "开始恢复"
Height = 375
Left = 2520
TabIndex = 9
Top = 2280
Width = 1095
End
Begin VB.TextBox txtRestorePath
Height = 270
Left = 1320
TabIndex = 8
Top = 600
Width = 2655
End
Begin VB.Label lblRestorePath
Caption = "恢复路径:"
Height = 255
Left = 360
TabIndex = 11
Top = 600
Width = 975
End
Begin VB.Label lblRestoreName
Caption = "恢复名称:"
Height = 255
Left = 360
TabIndex = 10
Top = 1080
Width = 975
End
End
Begin VB.Frame DB_Backup
Caption = "数据库备份"
Height = 3015
Left = 120
TabIndex = 0
Top = 120
Width = 4575
Begin VB.TextBox txtBackupName
Height = 270
Left = 1560
TabIndex = 6
Top = 1080
Width = 2655
End
Begin VB.TextBox txtBackupPath
Height = 270
Left = 1560
TabIndex = 5
Top = 600
Width = 2655
End
Begin VB.CommandButton cmdCancelBackup
Caption = "取消备份"
Height = 375
Left = 960
TabIndex = 2
Top = 2280
Width = 1095
End
Begin VB.CommandButton cmdBeginBackup
Caption = "开始备份"
Height = 375
Left = 2520
TabIndex = 1
Top = 2280
Width = 1095
End
Begin VB.Label lblBackupName
Caption = "默认备份名称:"
Height = 255
Left = 240
TabIndex = 4
Top = 1080
Width = 1335
End
Begin VB.Label lblBackupPath
Caption = "默认备份路径:"
Height = 255
Left = 240
TabIndex = 3
Top = 600
Width = 1335
End
End
End
Attribute VB_Name = "shujuku"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim AllRestoreName As String
Private Sub cmdBeginBackup_Click()
If Right(txtBackupPath.Text, 1) <> "\" Then
txtBackupPath.Text = txtBackupPath.Text & "\"
End If
If Right(txtBackupName.Text, 4) <> ".mdb" Then
txtBackupName.Text = txtBackupName.Text & ".mdb"
End If
FileCopy App.Path & DBname, txtBackupPath.Text & txtBackupName.Text
MsgBox "数据库备份成功!" & vbCr & vbCr & "备份路径为:" & txtBackupPath.Text & vbCr & vbCr & "备份文件为:" & txtBackupName.Text, vbOKOnly + vbInformation, App.Title
Unload Me
End Sub
Private Sub cmdBeginRestore_Click()
If RestoreName.Text = "" Then
MsgBox "请选择要还原的数据库文件!"
Exit Sub
End If
If Right(txtRestorePath.Text, 1) <> "\" Then
txtRestorePath.Text = txtRestorePath.Text & "\"
End If
FileCopy txtRestorePath.Text & RestoreName.Text, App.Path & DBname
MsgBox "数据库恢复成功!" & vbCr & vbCr & "现在使用的数据库为:" & txtRestorePath.Text & RestoreName.Text
Unload Me
End Sub
Private Sub cmdCancelBackup_Click()
Unload Me
End Sub
Private Sub cmdCancelRestore_Click()
Unload Me
End Sub
Private Sub Form_Load()
Call CheckLogin(Me)
Call SetCenter(Me)
txtBackupPath.Text = App.Path & "\backup\"
txtBackupName.Text = Date & ".mdb"
txtRestorePath.Text = App.Path & "\backup\"
If Right(txtRestorePath.Text, 1) <> "\" Then
txtRestorePath.Text = txtRestorePath.Text & "\"
End If
AllRestoreName = Dir(txtRestorePath.Text & "*.mdb", vbHidden + vbReadOnly)
Do While AllRestoreName <> ""
RestoreName.AddItem AllRestoreName
AllRestoreName = Dir()
Loop
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -