📄 frmback.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form frmback
BorderStyle = 1 'Fixed Single
Caption = "数据库备份"
ClientHeight = 2115
ClientLeft = 45
ClientTop = 330
ClientWidth = 3495
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2115
ScaleWidth = 3495
Begin MSComDlg.CommonDialog CommonDialog1
Left = 240
Top = 1320
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Frame Frame1
Caption = "备份"
Height = 1815
Left = 120
TabIndex = 0
Top = 120
Width = 3255
Begin VB.CommandButton Command4
Caption = "退出"
Height = 375
Left = 2040
TabIndex = 3
Top = 1320
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "开始备份"
Height = 375
Left = 600
TabIndex = 2
Top = 1320
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "<<"
Height = 375
Left = 2760
TabIndex = 1
Top = 720
Width = 375
End
Begin VB.Label Label2
Caption = "维修管理数据库"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 5
Top = 720
Width = 2175
End
Begin VB.Label Label1
Caption = "请选择数据库和备份的路径"
Height = 255
Left = 240
TabIndex = 4
Top = 240
Width = 2535
End
End
End
Attribute VB_Name = "frmback"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim con As New ADODB.Connection
Dim sql As String
Private Sub Command1_Click()
CommonDialog1.Filter = "备份文件(*.bak)|*.bak|文本文件(*.txt)|*.txt|ALL File(*.*)|*.*"
CommonDialog1.ShowSave
End Sub
Private Sub Command3_Click()
If CommonDialog1.FileName = "" Then
MsgBox "请您选择数据库备份的路径!", 64, "提示信息"
Else
con.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=wx;Initial Catalog=wxdb"
con.Open
sql = "backup DATABASE wxdb TO disk='" & CommonDialog1.FileName & "'" '备份数据库
con.Execute (sql) '执行SQL语句
con.Close
MsgBox "数据库备份成功!!", 64, "提示信息"
End If
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -