📄 form10.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form Form10
BackColor = &H80000013&
BorderStyle = 1 'Fixed Single
Caption = "数据备份"
ClientHeight = 3015
ClientLeft = 45
ClientTop = 435
ClientWidth = 5640
Icon = "Form10.frx":0000
LinkTopic = "Form10"
MaxButton = 0 'False
MinButton = 0 'False
Moveable = 0 'False
Picture = "Form10.frx":0442
ScaleHeight = 3015
ScaleWidth = 5640
Begin VB.CommandButton Command4
Height = 375
Left = 4800
Picture = "Form10.frx":09F9
Style = 1 'Graphical
TabIndex = 6
Top = 1680
Width = 495
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 600
Left = 3000
Picture = "Form10.frx":0A88
Style = 1 'Graphical
TabIndex = 5
Top = 2280
Width = 1400
End
Begin VB.CommandButton Command1
Caption = "备份"
Height = 600
Left = 1200
Picture = "Form10.frx":0B19
Style = 1 'Graphical
TabIndex = 4
Top = 2280
Width = 1400
End
Begin VB.TextBox Text2
Height = 375
Left = 360
TabIndex = 0
Top = 1680
Width = 4095
End
Begin VB.TextBox Text1
Height = 375
Left = 360
TabIndex = 2
Top = 600
Width = 4095
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 5040
Top = 0
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Label Label2
BackColor = &H80000013&
BackStyle = 0 'Transparent
Caption = "选择存放的位置"
ForeColor = &H00000000&
Height = 255
Left = 360
TabIndex = 3
Top = 1320
Width = 1455
End
Begin VB.Label Label1
BackColor = &H80000013&
BackStyle = 0 'Transparent
Caption = "源数据库"
ForeColor = &H00000000&
Height = 255
Left = 360
TabIndex = 1
Top = 240
Width = 1095
End
End
Attribute VB_Name = "Form10"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim jro1 As jro.JetEngine
Dim strsource As String
Dim strdress As String
Private Sub Command1_Click()
If (Form10.Text1.Text = "") Then
MsgBox ("数据源不能为空,请选择要备份的数据源!")
Else
If (Form10.Text2.Text = "") Then
MsgBox ("目标文件不能为空,请选择要存放到的目标文件!")
Text2.SetFocus
Else
Set jro1 = New jro.JetEngine
strsource = "Provider=Microsoft.Jet.OLEDB.4.0;"
strsource = strsource & "User ID=admin"
strsource = strsource & ";Mode=ReadWrite;Persist Security Info=False;"
strdress = strsource
strsource = ";Data Source=" & App.Path & "\data\database.mdb"
strdress = ";Data Source=" & Text2.Text & ";Jet OLEDB:Database Password=811205"
jro1.CompactDatabase strsource, strdress
MsgBox ("数据备份完成!")
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
CommonDialog1.ShowSave
Text1.Text = Form10.CommonDialog1.FileName
End Sub
Private Sub Command4_Click()
CommonDialog1.ShowSave
Text2.Text = Form10.CommonDialog1.FileName
End Sub
Private Sub Form_Load()
Form10.Top = 800
Form10.Left = 1000
CommonDialog1.Filter = "数据库文件(*.mdb)|*.mdb"
Text1.Text = "Database"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -