📄 frm_sjbfyhf.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frm_SJBFYHF
Caption = "数据备份与恢复"
ClientHeight = 3045
ClientLeft = 3360
ClientTop = 2940
ClientWidth = 4800
FillStyle = 2 'Horizontal Line
KeyPreview = -1 'True
LinkMode = 1 'Source
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3045
ScaleWidth = 4800
WhatsThisHelp = -1 'True
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 120
Top = 2640
Visible = 0 'False
Width = 1575
_ExtentX = 2778
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Command3
Caption = "取消"
Height = 375
Left = 3480
TabIndex = 7
Top = 2640
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "开始备份"
Height = 375
Left = 2040
TabIndex = 5
Top = 2640
Width = 1335
End
Begin VB.Frame Frame1
Caption = "请选择您要进行的操作"
Height = 735
Left = 0
TabIndex = 0
Top = 120
Width = 4815
Begin VB.OptionButton Option2
Caption = "数据恢复"
Height = 375
Left = 3000
TabIndex = 2
Top = 240
Width = 1335
End
Begin VB.OptionButton Option1
Caption = "数据备份"
Height = 375
Left = 840
TabIndex = 1
Top = 240
Width = 1815
End
End
Begin VB.CommandButton Command2
Caption = "开始恢复"
Height = 375
Left = 2040
TabIndex = 6
Top = 2640
Width = 1335
End
Begin VB.Frame Frame2
Caption = "数据备份"
Height = 1575
Left = 0
TabIndex = 3
Top = 960
Width = 4815
Begin MSComDlg.CommonDialog CommonDialog1
Left = 2760
Top = 120
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSComctlLib.ProgressBar ProgressBar1
Height = 285
Left = 240
TabIndex = 11
Top = 1080
Width = 4335
_ExtentX = 7646
_ExtentY = 503
_Version = 393216
Appearance = 1
End
Begin VB.CommandButton Command4
Caption = "<<"
Height = 310
Left = 4200
TabIndex = 10
Top = 600
Width = 375
End
Begin VB.TextBox Text1
Height = 300
Left = 240
TabIndex = 9
Top = 600
Width = 3975
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "请选择数据备份路径"
ForeColor = &H00C000C0&
Height = 255
Left = 240
TabIndex = 8
Top = 360
Width = 1935
End
End
Begin VB.Frame Frame3
Caption = "数据恢复"
Height = 1575
Left = 0
TabIndex = 4
Top = 960
Width = 4815
Begin MSComDlg.CommonDialog CommonDialog2
Left = 2640
Top = 120
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSComctlLib.ProgressBar ProgressBar2
Height = 285
Left = 240
TabIndex = 15
Top = 1080
Width = 4335
_ExtentX = 7646
_ExtentY = 503
_Version = 393216
Appearance = 1
End
Begin VB.CommandButton Command5
Caption = "<<"
Height = 310
Left = 4200
TabIndex = 14
Top = 600
Width = 375
End
Begin VB.TextBox Text2
Height = 300
Left = 240
Locked = -1 'True
TabIndex = 12
Top = 600
Width = 3975
End
Begin VB.Label Label3
Caption = "请选择数据恢复的路径"
ForeColor = &H00C000C0&
Height = 255
Left = 240
TabIndex = 13
Top = 360
Width = 1935
End
End
End
Attribute VB_Name = "frm_SJBFYHF"
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()
If Text1.Text = "" Then
MsgBox "请您选择数据库备份的路径!", 32, "房地产销售管理系统"
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
If Option1.Value = True Then
StrCnn.Open "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=Backup"
sql = "backup DATABASE Data_FDCGLXT TO disk='" & Text1.Text & "'"
StrCnn.Execute (sql) '执行SQL语句
StrCnn.Close
Else
End If
Next connter
ProgressBar1.Value = ProgressBar1.Min
MsgBox "数据库备份成功,请重新登录系统!"
End If
End Sub
Private Sub Command2_Click()
If Text2.Text = "" Then
MsgBox "请您选择数据库恢复的路径!", 32, "房地产销售管理系统"
Else
Dim connter As Integer
Dim sql, workarea(15) As String
ProgressBar2.Visible = True
ProgressBar2.Max = UBound(workarea)
ProgressBar2.Value = ProgressBar1.Min
For connter = LBound(workarea) To UBound(workarea)
workarea(connter) = "initial value" & connter
ProgressBar2.Value = connter
If Option2.Value = True Then
StrCnn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Data_FDCGLXT"
sql = "use master RESTORE DATABASE Data_FDCGLXT from disk='" & Text2.Text & "'"
StrCnn.Execute (sql) '执行SQL语句
StrCnn.Close
Else
End If
Next connter
ProgressBar2.Value = ProgressBar2.Min
MsgBox "数据库恢复成功,请重新登录系统!"
End If
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Command4_Click()
CommonDialog1.Filter = "文本文件(*.txt)|*.txt|ALL File(*.*)|*.*"
CommonDialog1.ShowSave
Text1.Text = CommonDialog1.FileName
Command1.Enabled = True
End Sub
Private Sub Command5_Click()
CommonDialog2.Filter = "文本文件(*.txt)|*.txt|ALL File(*.*)|*.*"
CommonDialog2.ShowOpen
Text2.Text = CommonDialog2.FileName
Command2.Enabled = True
End Sub
Private Sub Command6_Click()
Command1.Enabled = True
End Sub
Private Sub Option1_Click()
Frame2.Visible = True
Frame3.Visible = False
Command1.Visible = True
Command2.Visible = False
End Sub
Private Sub Option2_Click()
Frame2.Visible = False
Frame3.Visible = True
Command1.Visible = False
Command2.Visible = True
End Sub
Private Sub Form_Load()
Option1.Value = True '设置Option1的值为真
Command1.Enabled = False
Command2.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -