?? frmdbmgr.frm
字號:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
Begin VB.Form frmDBMaintain
BorderStyle = 3 'Fixed Dialog
Caption = "數據庫維護"
ClientHeight = 3210
ClientLeft = 45
ClientTop = 330
ClientWidth = 7500
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmDBMgr.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3210
ScaleWidth = 7500
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.TextBox txtDataFile
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1080
Locked = -1 'True
TabIndex = 7
Top = 480
Width = 4155
End
Begin VB.CommandButton cmdexit
Caption = "退 出(&Q)"
Height = 375
Left = 5880
TabIndex = 6
Top = 1440
Width = 1095
End
Begin VB.CommandButton cmdBackupDB
Caption = "備 份(&B)"
Height = 375
Left = 5880
TabIndex = 5
Top = 960
Width = 1095
End
Begin VB.CommandButton pathSel
Caption = "選 擇(&S)"
Height = 375
Left = 5880
TabIndex = 4
Top = 480
Width = 1095
End
Begin VB.TextBox txtBakDir
Appearance = 0 'Flat
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1080
Locked = -1 'True
TabIndex = 1
Top = 960
Width = 4155
End
Begin VB.Frame Frame1
Caption = "數據庫備份"
ForeColor = &H000040C0&
Height = 1155
Left = 240
TabIndex = 0
Top = 1920
Width = 5175
Begin VB.Label Label2
AutoSize = -1 'True
Caption = " 為了防止機器或硬盤出現無法恢復的錯誤,請定期使用“數據庫備份”將到目前為止的所有旅客信息和房間信息備份至指定目錄。"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 720
Left = 120
TabIndex = 2
Top = 240
Width = 4995
WordWrap = -1 'True
End
End
Begin MSComctlLib.ImageList imgTab
Left = 4680
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483644
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 4
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmDBMgr.frx":0442
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmDBMgr.frx":0894
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmDBMgr.frx":0CE6
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmDBMgr.frx":1138
Key = ""
EndProperty
EndProperty
End
Begin MSComDlg.CommonDialog dlgPath
Left = 4080
Top = 120
_ExtentX = 847
_ExtentY = 847
_Version = 393216
DefaultExt = "mdb"
DialogTitle = "請指定備份數據庫路徑"
FileName = "*.mdf"
Filter = "數據文件(*.mdf)|*.mdb"
FontName = "宋體"
FontSize = 9
InitDir = "..\dbbak\"
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "數據文件"
ForeColor = &H00FF0000&
Height = 210
Left = 120
TabIndex = 8
Top = 480
Width = 840
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "備份目錄"
ForeColor = &H00FF0000&
Height = 210
Left = 120
TabIndex = 3
Top = 960
Width = 840
End
End
Attribute VB_Name = "frmDBMaintain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim dbRec1 As Recordset
Dim dbRec2 As Recordset
Dim dbRec3 As Recordset
Dim tmpPath As String
Private Sub cmdBackupDB_Click()
On Error GoTo BackupDBErr
Dim MyMdb As String
If MsgBox("現在就開始數據庫備份嗎?", vbInformation + vbYesNo, "提 示") = vbYes Then
Me.MousePointer = 11
Call DataBack
MsgBox "數據庫備份完畢!請妥善保存備份文件,這些文件可用于恢復數據庫 !", vbInformation, "提 示"
End If
Me.MousePointer = 0
On Error GoTo 0
Exit Sub
BackupDBErr:
MsgBox "發生錯誤,現在將退出系統,請在重新進入系統后再備份數據庫。具體錯誤詳細描述如下:" & Err.Description, vbInformation, "提 示"
Me.MousePointer = 0
Unload Me
End Sub
Private Sub DataBack()
On Error GoTo RestoreDBErr
If Dir(Trim(txtBakDir.Text), vbDirectory) = "" Then
If MsgBox("您指定的目錄不存在,如果您想建立該目錄,并把最近一次的備份文件拷貝至該目錄下,請選擇確定;否則選擇取消重新指定目錄。", vbInformation + vbOKCancel, "提 示") = vbOK Then
MkDir Trim(txtBakDir.Text)
End If
Exit Sub
End If
FileCopy Trim(Me.txtDataFile.Text), Trim(Me.txtBakDir)
MsgBox "數據庫恢復完畢!", vbInformation, "提 示"
End
Exit Sub
RestoreDBErr:
MsgBox "發生錯誤,現在將退出系統,請在重新進入系統后再備份數據庫。錯誤詳細描述如下:" & Err.Description, vbInformation, "提 示"
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub pathSel_Click()
dlgPath.Flags = cdlOFNHideReadOnly Or cdlOFNOverwritePrompt
dlgPath.FileName = tmpPath
dlgPath.ShowOpen
If Trim(dlgPath.FileName) <> "" Then
tmpPath = dlgPath.FileName
End If
Me.txtDataFile = Trim(tmpPath)
End Sub
Private Sub Form_Load()
If Dir(App.Path & "\bak\", vbDirectory) = "" Then CreateDir ("bak")
txtBakDir.Text = App.Path & "\BAK\"
If UserInfo.QX = 1 Then
Me.cmdBackupDB.Enabled = False
Me.pathSel.Enabled = False
End If
Me.txtDataFile = "D:\Program Files\Microsoft SQL Server\MSSQL\Data\"
End Sub
Public Sub CreateDir(Dir As String)
MkDir App.Path & "\" & Dir
End Sub
Private Sub txtBakDir_GotFocus()
txtBakDir.SelStart = 0
txtBakDir.SelLength = Len(txtBakDir.Text)
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -