📄 frmsystemdatabase.frm
字号:
VERSION 5.00
Begin VB.Form frmSystemDatabase
BorderStyle = 3 'Fixed Dialog
Caption = "数据库设置"
ClientHeight = 6375
ClientLeft = 45
ClientTop = 435
ClientWidth = 5655
Icon = "frmSystemDatabase.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6375
ScaleWidth = 5655
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame1
Caption = "登录方式"
Height = 2295
Left = 240
TabIndex = 12
Top = 180
Width = 5055
Begin VB.OptionButton optEnterMode
Caption = "本地"
Height = 315
Index = 0
Left = 660
TabIndex = 17
Top = 300
Width = 1275
End
Begin VB.TextBox txtAddress1
Enabled = 0 'False
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 780
TabIndex = 16
Text = "http://www.autosi.com.cn/zowa/autosidlan.asp"
Top = 720
Width = 4095
End
Begin VB.TextBox txtAddress2
Enabled = 0 'False
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 780
TabIndex = 15
Top = 1260
Width = 4095
End
Begin VB.OptionButton optEnterMode
Caption = "远程"
Height = 315
Index = 1
Left = 2220
TabIndex = 14
Top = 300
Width = 1275
End
Begin VB.CommandButton cmdGetAddress
Caption = "获取数据库地址 &G"
Enabled = 0 'False
Height = 375
Left = 3060
TabIndex = 13
Top = 1800
Width = 1815
End
Begin VB.Label Label1
Caption = "地址1"
Height = 255
Index = 0
Left = 180
TabIndex = 19
Top = 780
Width = 495
End
Begin VB.Label Label1
Caption = "地址2"
Height = 255
Index = 1
Left = 180
TabIndex = 18
Top = 1380
Width = 495
End
End
Begin VB.Frame Frame2
Caption = "数据库设置"
Height = 3135
Left = 240
TabIndex = 3
Top = 2580
Width = 5055
Begin VB.TextBox txtPort
Height = 375
Left = 1140
TabIndex = 20
Text = "717"
Top = 900
Width = 3735
End
Begin VB.TextBox txtServerName
Height = 375
Left = 1140
TabIndex = 7
Text = "."
Top = 360
Width = 3735
End
Begin VB.TextBox txtDatabase
Height = 375
Left = 1140
TabIndex = 6
Text = "SinoDatabase"
Top = 1440
Width = 3735
End
Begin VB.TextBox txtUserid
Height = 375
Left = 1140
TabIndex = 5
Text = "sa"
Top = 1980
Width = 3735
End
Begin VB.TextBox txtPassword
Height = 375
IMEMode = 3 'DISABLE
Left = 1140
PasswordChar = "*"
TabIndex = 4
Top = 2520
Width = 3735
End
Begin VB.Label Label1
Caption = "数据库端口"
Height = 255
Index = 6
Left = 180
TabIndex = 21
Top = 960
Width = 915
End
Begin VB.Label Label1
Caption = "数据库地址"
Height = 255
Index = 2
Left = 180
TabIndex = 11
Top = 420
Width = 915
End
Begin VB.Label Label1
Caption = "数据库名"
Height = 255
Index = 3
Left = 180
TabIndex = 10
Top = 1500
Width = 915
End
Begin VB.Label Label1
Caption = "用户名"
Height = 255
Index = 4
Left = 180
TabIndex = 9
Top = 2040
Width = 915
End
Begin VB.Label Label1
Caption = "登录密码"
Height = 255
Index = 5
Left = 180
TabIndex = 8
Top = 2580
Width = 915
End
End
Begin VB.CommandButton cmdTest
Caption = "测试 &T"
Height = 375
Left = 660
TabIndex = 2
Top = 5760
Width = 1155
End
Begin VB.CommandButton cmdOk
Caption = "确定 &Y"
Height = 375
Left = 2220
TabIndex = 1
Top = 5760
Width = 1155
End
Begin VB.CommandButton cmdCancel
Caption = "取消 &C"
Height = 375
Left = 3780
TabIndex = 0
Top = 5760
Width = 1155
End
End
Attribute VB_Name = "frmSystemDatabase"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public exitSystem As Boolean
''如果是启动时弹出此模块 true
''退出时应退出整个程序
''否则就应只关闭此模块
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdGetAddress_Click()
cmdGetAddress.Enabled = False
SystemExecuteStart frmSystemDatabase
objDatabase.SetAddress1 txtAddress1.Text
txtServerName.Text = ResponseAddress(objDatabase.GetAddress1 & "?id=1")
SystemExecuteEnd frmSystemDatabase
cmdGetAddress.Enabled = True
End Sub
Private Sub cmdOk_Click()
SystemExecuteStart frmSystemDatabase
cmdOk.Enabled = False
If optEnterMode(0).Value = True Then
objDatabase.SetEnterMode True
Else
objDatabase.SetEnterMode False
End If
objDatabase.SetServerName Trim$(txtServerName.Text)
objDatabase.SetPort Trim$(txtPort.Text)
objDatabase.SetDatabase Trim$(txtDatabase.Text)
objDatabase.SetUserID Trim$(txtUserid.Text)
objDatabase.SetPassword Trim$(txtPassword.Text)
objDatabase.SetAddress1 Trim$(txtAddress1.Text)
objDatabase.SetAddress2 Trim$(txtAddress2.Text)
If objDatabase.OpenIni(True) = True Then
If MsgBox("数据库配置设置成功! " & vbCrLf & "是否请重新打开数据库?如果选择否,程序将退出。", vbInformation + vbYesNo, "提示") = vbYes Then
cmdOk.Enabled = False
If objDatabase.OpenData = True Then
Unload Me
Else
MsgBox "打开数据库出错!", vbCritical, "提示"
End If
Else
End
End If
End If
SystemExecuteEnd frmSystemDatabase
cmdOk.Enabled = True
End Sub
Private Sub cmdTest_Click()
cmdTest.Enabled = False
SystemExecuteStart frmSystemDatabase
If optEnterMode(0).Value = True Then
objDatabase.SetEnterMode True
Else
objDatabase.SetEnterMode False
objDatabase.NewServerName
End If
objDatabase.SetServerName Trim$(txtServerName.Text)
objDatabase.SetPort Trim$(txtPort.Text)
objDatabase.SetDatabase Trim$(txtDatabase.Text)
objDatabase.SetUserID Trim$(txtUserid.Text)
objDatabase.SetPassword Trim$(txtPassword.Text)
objDatabase.SetAddress1 Trim$(txtAddress1.Text)
objDatabase.SetAddress2 Trim$(txtAddress2.Text)
If objDatabase.OpenData = True Then
MsgBox "测试成功!", vbInformation, "提示"
Else
MsgBox "测试失败,打开数据库出错!", vbCritical, "提示"
End If
SystemExecuteEnd frmSystemDatabase
cmdTest.Enabled = True
End Sub
Private Sub Form_Load()
'设置窗口大小
FormInit Me, False
''读取配置
objDatabase.OpenIni (False)
''显示当前配置
txtAddress1.Text = objDatabase.GetAddress1
txtAddress2.Text = objDatabase.GetAddress2
''登录方式是本地还是远程
If objDatabase.GetEnterMode = True Then
optEnterMode(0).Value = True
Else
optEnterMode(1).Value = True
txtAddress1.Enabled = True
txtAddress2.Enabled = True
cmdGetAddress.Enabled = True
End If
txtServerName = objDatabase.GetServerName
txtPort.Text = objDatabase.GetPort
txtDatabase = objDatabase.GetDatabase
txtUserid = objDatabase.GetUserID
txtPassword = objDatabase.GetPassword
End Sub
Private Sub Form_Unload(Cancel As Integer)
If exitSystem = True Then
End
End If
End Sub
Private Sub optEnterMode_Click(Index As Integer)
If Index = 0 Then
txtAddress1.Enabled = False
txtAddress2.Enabled = False
cmdGetAddress.Enabled = False
Else
txtAddress1.Enabled = True
txtAddress2.Enabled = True
cmdGetAddress.Enabled = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -