?? frmbackup.frm
字號:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form frmbackup
Caption = "備份與恢復"
ClientHeight = 5085
ClientLeft = 60
ClientTop = 450
ClientWidth = 3735
LinkTopic = "form2"
ScaleHeight = 5085
ScaleWidth = 3735
StartUpPosition = 3 '窗口缺省
Begin MSComDlg.CommonDialog CommonDialog1
Left = 3120
Top = 1920
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 855
Left = 600
TabIndex = 2
Top = 3120
Width = 2295
End
Begin VB.CommandButton Command2
Caption = "備份"
Height = 855
Left = 600
TabIndex = 1
Top = 480
Width = 2295
End
Begin VB.CommandButton Command1
Caption = "恢復"
Height = 735
Left = 600
TabIndex = 0
Top = 1800
Width = 2295
End
End
Attribute VB_Name = "frmbackup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command2_Click()
Dim sql As String
On Error GoTo errhandler
conn.Close
conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=master;Data Source=."
conn.Open
CommonDialog1.ShowSave
sql = "backup database book to disk='" & CommonDialog1.FileName & "'"
CommonDialog1.CancelError = True
conn.Execute (sql)
MsgBox "備份成功", vbOKOnly + vbExclamation, "恭喜"
conn.Close
Exit Sub
errhandler:
Exit Sub
End Sub
Private Sub Command1_Click()
Dim sql As String
On Error GoTo errhandler
conn.Close
conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=master;Data Source=."
conn.Open
CommonDialog1.ShowOpen
CommonDialog1.CancelError = True
sql = "restore database book from disk='" & CommonDialog1.FileName & "'"
conn.Execute (sql)
MsgBox "恢復成功", vbOKOnly + vbExclamation, "恭喜"
conn.Close
Exit Sub
errhandler:
Exit Sub
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
CommonDialog1.Filter = "備份文件(*.bak)"
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -