📄 数据恢复.frm
字号:
VERSION 5.00
Begin VB.Form 数据恢复
Caption = "图书管理系统"
ClientHeight = 4080
ClientLeft = 5880
ClientTop = 2445
ClientWidth = 4485
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 4080
ScaleWidth = 4485
Begin VB.DriveListBox Drv1
Height = 300
Left = 1320
TabIndex = 3
Top = 240
Width = 2895
End
Begin VB.DirListBox Dir1
Height = 2190
Left = 1320
TabIndex = 2
Top = 720
Width = 2895
End
Begin VB.TextBox Txtfilename1
Height = 375
Left = 1320
TabIndex = 1
Top = 3000
Width = 2895
End
Begin VB.CommandButton Recovery
Caption = "恢复"
Height = 375
Left = 1680
TabIndex = 0
Top = 3480
Width = 975
End
Begin VB.Label Label21
AutoSize = -1 'True
Caption = "文件路径"
Height = 180
Left = 240
TabIndex = 6
Top = 720
Width = 720
End
Begin VB.Label Label22
AutoSize = -1 'True
Caption = "文件名称"
Height = 180
Left = 240
TabIndex = 5
Top = 3000
Width = 720
End
Begin VB.Label Label23
AutoSize = -1 'True
Caption = "逻辑盘符"
Height = 180
Left = 240
TabIndex = 4
Top = 240
Width = 720
End
End
Attribute VB_Name = "数据恢复"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Unload(Cancel As Integer)
系统操作.Show
End Sub
Private Sub Drv1_Change()
Dir1.Path = Drv1.Drive
End Sub
Private Sub Dir1_Change()
If Trim(Txtfilename1) = "" Then
Txtfilename1 = Dir1.Path + "\"
Else
Txtfilename1 = Dir1.Path + "\" + Right(Txtfilename1, Len(Txtfilename1) - InStrRev(Txtfilename1, "\"))
End If
End Sub
Private Sub Form_Load()
Txtfilename1 = Dir1.Path + "\"
End Sub
Private Sub Recovery_Click()
On Error GoTo ERR
Dim strDest As String
Dim strSourcefile As String
Dim fso As New Scripting.FileSystemObject
'输入备份文件名
strSourcefile = Trim(Right(Txtfilename1, Len(Txtfilename1) - InStrRev(Txtfilename1, "\")))
If strSourcefile = "" Then
MsgBox "请您输入备份文件名!"
Txtfilename1.SetFocus
ERR.Raise 3001
Else
'若不存在源备份文件,则报错
If Not fso.FileExists(Txtfilename1) Then MsgBox "备份文件不存在": Txtfilename1.SetFocus: ERR.Raise 3001
strDest = App.Path + "\Libarary.mdb"
'若存在目的数据库文件,则先删除
If fso.FileExists(strDest) Then
If MsgBox("是否要覆盖LIBARARY数据库文件?", vbOKCancel) = vbCancel Then MsgBox "恢复肯定要覆盖LIBARARY数据库文件": ERR.Raise 3001
If de.Libarary.State = 1 Then de.Libarary.Close
fso.DeleteFile strDest
If de.Libarary.State = 0 Then de.Libarary.Open
End If
'恢复
If de.Libarary.State = 1 Then de.Libarary.Close
fso.CopyFile Txtfilename1, strDest, True
If de.Libarary.State = 0 Then de.Libarary.Open
MsgBox "恢复完毕"
Unload Me
End If
Exit Sub
ERR:
If ERR.Number = 3001 Then Exit Sub
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -