?? frm_sjbfyhf.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 frm_sjbf
Caption = "數據備份"
ClientHeight = 3795
ClientLeft = 60
ClientTop = 345
ClientWidth = 5625
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 3795
ScaleWidth = 5625
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text3
Height = 270
Left = 3120
TabIndex = 19
Text = "Text3"
Top = 5400
Width = 1215
End
Begin VB.CheckBox Check10
Caption = "Check10"
Height = 255
Left = 5160
TabIndex = 18
Top = 4440
Width = 975
End
Begin VB.CheckBox Check9
Caption = "Check9"
Height = 255
Left = 4080
TabIndex = 17
Top = 4440
Width = 855
End
Begin VB.CheckBox Check8
Caption = "Check8"
Height = 255
Left = 2760
TabIndex = 16
Top = 4440
Width = 1095
End
Begin VB.CheckBox Check7
Caption = "Check7"
Height = 255
Left = 1440
TabIndex = 15
Top = 4440
Width = 1095
End
Begin VB.CheckBox Check6
Caption = "Check6"
Height = 255
Left = 120
TabIndex = 14
Top = 4440
Width = 975
End
Begin VB.CheckBox Check5
Caption = "Check5"
Height = 255
Left = 4800
TabIndex = 13
Top = 4080
Width = 1095
End
Begin VB.CheckBox Check4
Caption = "Check4"
Height = 255
Left = 3600
TabIndex = 12
Top = 4080
Width = 975
End
Begin VB.CheckBox Check3
Caption = "Check3"
Height = 255
Left = 2520
TabIndex = 11
Top = 4080
Width = 855
End
Begin VB.CheckBox Check2
Caption = "Check2"
Height = 255
Left = 1440
TabIndex = 10
Top = 4080
Width = 855
End
Begin VB.CheckBox Check1
Caption = "Check1"
Height = 375
Left = 120
TabIndex = 9
Top = 3960
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 4485
TabIndex = 5
Top = 3390
Width = 1095
End
Begin VB.PictureBox Picture1
Height = 3255
Left = 75
Picture = "frm_sjbfyhf.frx":0000
ScaleHeight = 3195
ScaleWidth = 1755
TabIndex = 0
Top = 90
Width = 1815
End
Begin VB.CommandButton Command1
Caption = "開始備份"
Height = 375
Left = 3345
TabIndex = 4
Top = 3390
Width = 1095
End
Begin VB.Frame Frame1
Height = 3375
Left = 1965
TabIndex = 1
Top = -15
Width = 3615
Begin MSComDlg.CommonDialog CommonDialog1
Left = 2520
Top = 1680
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command3
Caption = "<<"
Height = 310
Left = 3120
TabIndex = 7
Top = 2520
Width = 375
End
Begin MSComctlLib.ProgressBar ProgressBar1
Height = 300
Left = 120
TabIndex = 6
Top = 3000
Width = 3375
_ExtentX = 5953
_ExtentY = 529
_Version = 393216
Appearance = 1
End
Begin VB.TextBox Text1
Height = 300
Left = 120
TabIndex = 3
Top = 2520
Width = 3015
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "單擊“<<”圖標按鈕,選擇一個要備份數據的文件夾,然后單擊“開始備份”按鈕開始備份數據"
Height = 615
Index = 1
Left = 480
TabIndex = 8
Top = 960
Width = 2775
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "選擇數據庫備份路徑"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C000C0&
Height = 375
Left = 120
TabIndex = 2
Top = 2160
Width = 2535
End
End
End
Attribute VB_Name = "frm_sjbf"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim StrCnn As New Connection '定義連接
Dim key, list, sql As String '定義字符串變量
Private Sub Command1_Click()
Command1.Enabled = False
If Text1.Text = "" Then
MsgBox "請您選擇數據庫備份的路徑!", 64, "醫院住院管理系統"
Else
Dim connter As Integer
Dim sql, workarea(15) As String
ProgressBar1.Visible = True
ProgressBar1.Max = UBound(workarea)
ProgressBar1.Value = ProgressBar1.Min
For connter = LBound(workarea) To UBound(workarea)
workarea(connter) = "initial value" & connter
ProgressBar1.Value = connter
StrCnn.Open "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=Backup"
sql = "backup DATABASE Data_ZYGL TO disk='" & Text1.Text & "'"
StrCnn.Execute (sql) '執行SQL語句
StrCnn.Close
Next connter
ProgressBar1.Value = ProgressBar1.Min
MsgBox "數據庫備份成功!!", 64, "醫院住院管理系統"
Command1.Enabled = True
End If
frm_main.Label6.Caption = Text3.Text
frm_main.Check1.Value = Check1.Value
frm_main.Check2.Value = Check2.Value
frm_main.Check3.Value = Check3.Value
frm_main.Check4.Value = Check4.Value
frm_main.Check5.Value = Check5.Value
frm_main.Check6.Value = Check6.Value
frm_main.Check7.Value = Check7.Value
frm_main.Check8.Value = Check8.Value
frm_main.Check9.Value = Check9.Value
frm_main.Check10.Value = Check10.Value
End Sub
Private Sub Command2_Click()
frm_main.Label6.Caption = Text3.Text
frm_main.Check1.Value = Check1.Value
frm_main.Check2.Value = Check2.Value
frm_main.Check3.Value = Check3.Value
frm_main.Check4.Value = Check4.Value
frm_main.Check5.Value = Check5.Value
frm_main.Check6.Value = Check6.Value
frm_main.Check7.Value = Check7.Value
frm_main.Check8.Value = Check8.Value
frm_main.Check9.Value = Check9.Value
frm_main.Check10.Value = Check10.Value
Unload Me
frm_main.Show
End Sub
Private Sub Command3_Click()
CommonDialog1.Filter = "備份文件(*.bak)|*.bak|文本文件(*.txt)|*.txt|ALL File(*.*)|*.*"
CommonDialog1.ShowSave
Text1.Text = CommonDialog1.FileName
End Sub
Private Sub Command4_Click()
Command4.Enabled = False
If Text2.Text = "" Then
MsgBox "請您選擇數據庫恢復的路徑!", 64, "醫院住院管理系統"
Else
Dim connter As Integer
Dim sql, workarea(15) As String
ProgressBar2.Visible = True
ProgressBar2.Max = UBound(workarea)
ProgressBar2.Value = ProgressBar2.Min
For connter = LBound(workarea) To UBound(workarea)
workarea(connter) = "initial value" & connter
ProgressBar2.Value = connter
StrCnn.Open "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=Backup"
sql = "RESTORE DATABASE Data_ZYGL from disk='" & Text2.Text & "'"
StrCnn.Execute (sql) '執行SQL語句
StrCnn.Close
Next connter
ProgressBar2.Value = ProgressBar2.Min
MsgBox "數據庫恢復成功!!", 64, "醫院住院管理系統"
Command4.Enabled = True
End If
frm_main.Label6.Caption = Text3.Text
frm_main.Check1.Value = Check1.Value
frm_main.Check2.Value = Check2.Value
frm_main.Check3.Value = Check3.Value
frm_main.Check4.Value = Check4.Value
frm_main.Check5.Value = Check5.Value
frm_main.Check6.Value = Check6.Value
frm_main.Check7.Value = Check7.Value
frm_main.Check8.Value = Check8.Value
frm_main.Check9.Value = Check9.Value
frm_main.Check10.Value = Check10.Value
End Sub
Private Sub Command5_Click()
CommonDialog2.Filter = "備份文件(*.bak)|*.bak|文本文件(*.txt)|*.txt|ALL File(*.*)|*.*"
CommonDialog2.ShowOpen
Text2.Text = CommonDialog2.FileName
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Text3.Text = frm_main.Label6.Caption
Check1.Value = frm_main.Check1.Value
Check2.Value = frm_main.Check2.Value
Check3.Value = frm_main.Check3.Value
Check4.Value = frm_main.Check4.Value
Check5.Value = frm_main.Check5.Value
Check6.Value = frm_main.Check6.Value
Check7.Value = frm_main.Check7.Value
Check8.Value = frm_main.Check8.Value
Check9.Value = frm_main.Check9.Value
Check10.Value = frm_main.Check10.Value
Unload frm_main
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -