📄 bfhf.frm
字号:
VERSION 5.00
Begin VB.Form BfHf
Caption = "备份"
ClientHeight = 4605
ClientLeft = 60
ClientTop = 345
ClientWidth = 6765
LinkTopic = "Form1"
ScaleHeight = 4605
ScaleWidth = 6765
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command2
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5280
TabIndex = 4
Top = 2325
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5280
TabIndex = 3
Top = 1245
Width = 1215
End
Begin VB.DriveListBox Drive1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 465
TabIndex = 2
Top = 360
Width = 1815
End
Begin VB.DirListBox Dir1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3060
Left = 360
TabIndex = 1
Top = 960
Width = 2295
End
Begin VB.FileListBox File1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 3210
Left = 2910
Pattern = "*.lo"
TabIndex = 0
Top = 945
Width = 2055
End
End
Attribute VB_Name = "BfHf"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public state As String
Dim strpath As String
Dim mycommand As New ADODB.Command
Private Sub Command1_Click()
On Error GoTo err:
Dim myconn As New ADODB.Connection
myconn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=master"
myconn.Open
mycommand.ActiveConnection = myconn
mycommand.CommandType = adCmdText
If state = "Bf" Then
strpath = "BACKUP DATABASE [" & Data & "] TO DISK = N'" & Dir1.Path & "\" & Data & ".lo' WITH INIT , NOUNLOAD , NAME = N'GYZC10 备份', NOSKIP , STATS = 10, NOFORMAT "
mycommand.CommandText = strpath
mycommand.Execute
MsgBox "备份成功", vbInformation, "提示"
End If
If state = "Hy" Then
If File1.FileName = Data & ".lo" Then
strpath = "RESTORE DATABASE [" & Data & "] FROM DISK = N'" & Dir1.Path & "\" & Data & ".lo" & "'" & " WITH FILE = 1, NOUNLOAD , STATS = 10, RECOVERY"
MsgBox (strpath)
mycommand.CommandText = strpath
mycommand.Execute
MsgBox "还原成功", vbInformation, "提示"
End If
End If
Unload Me
Exit Sub
err:
MsgBox err.Description, vbInformation, "提示"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -