📄 frm_sql_set.frm
字号:
VERSION 5.00
Begin VB.Form Frm_Sql_set
Caption = "设置数据库备份的向导"
ClientHeight = 4365
ClientLeft = 60
ClientTop = 345
ClientWidth = 5460
Icon = "Frm_Sql_set.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4365
ScaleWidth = 5460
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Caption = "设置SQL数据库备份的参数"
Height = 2895
Left = 240
TabIndex = 5
Top = 840
Width = 4935
Begin VB.TextBox Txt_Sql_servername
Height = 375
Left = 2400
TabIndex = 13
Text = "Txt_Sql_servername"
Top = 360
Width = 2055
End
Begin VB.TextBox Txt_Sql_userid
Height = 375
Left = 2400
TabIndex = 8
Text = "Txt_Sql_userid"
Top = 1000
Width = 2055
End
Begin VB.TextBox Txt_Sql_password
Height = 375
IMEMode = 3 'DISABLE
Left = 2400
PasswordChar = "*"
TabIndex = 7
Text = "Txt_Sql_password"
Top = 1640
Width = 2055
End
Begin VB.TextBox Txt_Sql_dbname
Height = 375
Left = 2400
TabIndex = 6
Text = "Txt_Sql_dbname"
Top = 2280
Width = 2055
End
Begin VB.Label Label5
Caption = "SQL用户名:"
Height = 255
Left = 360
TabIndex = 14
Top = 1125
Width = 1335
End
Begin VB.Label Label1
Caption = "数据库名称:"
Height = 375
Left = 360
TabIndex = 11
Top = 2280
Width = 1935
End
Begin VB.Label Label2
Caption = "SQL服务器名称:"
Height = 375
Left = 360
TabIndex = 10
Top = 480
Width = 1815
End
Begin VB.Label Label3
Caption = "SQL密码:"
Height = 375
Left = 360
TabIndex = 9
Top = 1635
Width = 1455
End
End
Begin VB.CommandButton cmdNav
Caption = "完成(&F)"
Height = 312
Index = 4
Left = 4560
MaskColor = &H00000000&
TabIndex = 4
Tag = "104"
Top = 3840
Width = 855
End
Begin VB.CommandButton cmdNav
Caption = "下一步(&N)"
Height = 312
Index = 3
Left = 3360
MaskColor = &H00000000&
TabIndex = 3
Tag = "103"
Top = 3840
Width = 1092
End
Begin VB.CommandButton cmdNav
Cancel = -1 'True
Caption = "取消"
Height = 312
Index = 1
Left = 1200
MaskColor = &H00000000&
TabIndex = 2
Tag = "101"
Top = 3840
Width = 855
End
Begin VB.CommandButton cmdNav
Caption = "测试连接"
Height = 312
Index = 0
Left = 0
MaskColor = &H00000000&
TabIndex = 1
Tag = "100"
Top = 3840
Width = 1092
End
Begin VB.CommandButton cmdNav
Caption = "上一步(&N)"
Height = 312
Index = 2
Left = 2160
MaskColor = &H00000000&
TabIndex = 0
Tag = "103"
Top = 3840
Width = 1092
End
Begin VB.Label Label4
Caption = "设置ORACLE数据库备份的参数:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 255
Left = 240
TabIndex = 12
Top = 240
Width = 3015
End
End
Attribute VB_Name = "Frm_Sql_set"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdNav_Click(Index As Integer)
Select Case Index
Case 0
If Trim(Txt_Sql_userid.Text) = "" Then
MsgBox "请输入SQL数据库服务器名称!", vbCritical, Me.Caption
Exit Sub
End If
Call ConnectDB
Case 1
Unload Me
Case 2
Call Save_regedit
Frmchoice.Show
Unload Me
Case 3
Call Save_regedit
Frm_time_set.Show
Unload Me
Case 4
Call Save_regedit
Tempstr = "完成SQL备份参数设置。"
Call writerizhi(Tempstr, Len(Tempstr))
Unload Me
End Select
End Sub
Private Sub Command1_Click()
Call Sqlbackup
End Sub
Private Sub Form_Load()
CenterForm Me
On Error GoTo errhandler
Txt_Sql_userid.Text = GetSetting("databackup", "sysinformation", "Txt_Sql_userid")
If Trim(GetSetting("databackup", "sysinformation", "Txt_Sql_password")) = "" Then
Txt_Sql_password.Text = ""
Else
Txt_Sql_password.Text = EncryptText(GetSetting("databackup", "sysinformation", "Txt_Sql_password"), "ljp")
End If
Txt_Sql_servername.Text = GetSetting("databackup", "sysinformation", "Txt_Sql_servername")
Txt_Sql_dbname.Text = GetSetting("databackup", "sysinformation", "Txt_Sql_dbname")
Exit Sub
errhandler:
Txt_Sql_userid.Text = ""
Txt_Sql_password.Text = ""
Txt_Sql_servername.Text = ""
Txt_Sql_dbname = ""
End Sub
Private Sub ConnectDB()
On Error Resume Next
SqlConnectstring = "Provider=SQLOLEDB.1;Password=" + Txt_Sql_password.Text + ";Persist Security Info=False;User ID=" + Txt_Sql_userid.Text + ";Initial Catalog=" + Txt_Sql_dbname.Text + ";Data Source=" + Txt_Sql_servername.Text
SqlCn.ConnectionString = SqlConnectstring
SqlCn.Open
If Err.Number <> 0 Then
Screen.MousePointer = 0
MsgBox "数据库连接失败!", vbCritical, Me.Caption
Exit Sub
End If
MsgBox "数据库测试成功!", vbInformation + vbOKOnly, Me.Caption
SqlCn.Close
End Sub
Private Sub Save_regedit()
SaveSetting "databackup", "sysinformation", "Txt_Sql_servername", Trim(Txt_Sql_servername)
SaveSetting "databackup", "sysinformation", "Txt_Sql_userid", Trim(Txt_Sql_userid)
If Trim(Txt_Sql_password.Text) = "" Then
SaveSetting "databackup", "sysinformation", "Txt_Sql_password", Txt_Sql_password.Text
Else
SaveSetting "databackup", "sysinformation", "Txt_Sql_password", EncryptText(Trim(Txt_Sql_password.Text), "ljp")
End If
SaveSetting "databackup", "sysinformation", "Txt_Sql_dbname", Trim(Txt_Sql_dbname)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -