📄 frmrecover.frm
字号:
VERSION 5.00
Begin VB.Form FrmRecover
BorderStyle = 1 'Fixed Single
Caption = "数据恢复"
ClientHeight = 4410
ClientLeft = 4470
ClientTop = 3525
ClientWidth = 5715
Icon = "FrmRecover.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 4410
ScaleWidth = 5715
Begin VB.Frame Frame2
Height = 1365
Left = 4590
TabIndex = 5
Top = 3030
Width = 1065
Begin VB.CommandButton Command1
Caption = "恢复"
Height = 330
Left = 120
TabIndex = 7
Top = 330
Width = 840
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 330
Left = 120
TabIndex = 6
Top = 720
Width = 840
End
End
Begin VB.TextBox Text2
BackColor = &H80000004&
Height = 855
Left = 60
MultiLine = -1 'True
TabIndex = 3
Text = "FrmRecover.frx":0442
Top = 3540
Width = 255
End
Begin VB.Frame Frame1
Caption = "备份记录"
Height = 2895
Left = 60
TabIndex = 1
Top = 120
Width = 5565
Begin VB.ListBox List1
Height = 2580
ItemData = "FrmRecover.frx":044D
Left = 120
List = "FrmRecover.frx":044F
TabIndex = 2
Top = 210
Width = 5325
End
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 855
Left = 330
TabIndex = 0
Top = 3540
Width = 4095
End
Begin VB.Label Label1
Height = 465
Left = 60
TabIndex = 4
Top = 3060
Width = 4455
End
End
Attribute VB_Name = "FrmRecover"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sqlStr As String
Private Sub Command1_Click()
On Error GoTo Err
Dim strName As String
Dim PathName As String
strName = List1.Text
sqlStr = "select * from recover where DATETIME='" & strName & "'"
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\mgydb.mdb;Persist Security Info=False"
conn.Open
rs.Open sqlStr, conn, adOpenDynamic, adLockOptimistic, -1
PathName = rs("DIRNAME")
rs.Close
conn.Close
FileCopy PathName, App.Path & "\mgydb.mdb"
MsgBox "数据恢复成功!", vbInformation + vbOKOnly, "操作成功"
Exit Sub
Err:
MsgBox "数据恢复失败!", vbExclamation + vbOKOnly, "操作失败"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
Dim i As Integer
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\mgydb.mdb;Persist Security Info=False"
conn.Open
sqlStr = "select * from recover"
rs.Open sqlStr, conn, adOpenDynamic, adLockOptimistic, -1
While rs.EOF = False
List1.AddItem rs("DATETIME")
rs.MoveNext
Wend
rs.Close
conn.Close
End Sub
Private Sub List1_Click()
Dim strName As String
strName = List1.Text
sqlStr = "select * from recover where DATETIME='" & strName & "'"
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\mgydb.mdb;Persist Security Info=False"
conn.Open
rs.Open sqlStr, conn, adOpenDynamic, adLockOptimistic, -1
Text1.Text = rs("MEMO")
Label1.Caption = "备份数据:" & rs("DIRNAME")
rs.Close
conn.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -