📄 frmserver.frm
字号:
VERSION 5.00
Begin VB.Form frmServer
BorderStyle = 3 'Fixed Dialog
Caption = "设置 SQL 服务器"
ClientHeight = 2715
ClientLeft = 45
ClientTop = 330
ClientWidth = 4560
Icon = "frmServer.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 181
ScaleMode = 3 'Pixel
ScaleWidth = 304
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin MySuperMarket.FTextBox txtUser
Height = 300
Left = 1080
TabIndex = 1
Top = 720
Width = 3315
_ExtentX = 5847
_ExtentY = 529
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
FontName = "宋体"
FontSize = 9
AutoSelAll = -1 'True
End
Begin MySuperMarket.XPButton cmdExit
Cancel = -1 'True
Height = 345
Left = 3300
TabIndex = 5
Top = 2220
Width = 1095
_ExtentX = 1931
_ExtentY = 609
Caption = "取消"
CapAlign = 2
BackStyle = 2
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Mode = 0
Value = 0 'False
cBack = -2147483633
End
Begin MySuperMarket.XPButton cmdOK
Default = -1 'True
Height = 345
Left = 2100
TabIndex = 4
Top = 2220
Width = 1095
_ExtentX = 1931
_ExtentY = 609
Caption = "确定"
CapAlign = 2
BackStyle = 2
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "新宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Mode = 0
Value = 0 'False
cBack = -2147483633
End
Begin MySuperMarket.FTextBox txtServer
Height = 300
Left = 1080
TabIndex = 0
Top = 240
Width = 3315
_ExtentX = 5847
_ExtentY = 529
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
FontName = "宋体"
FontSize = 9
AutoSelAll = -1 'True
End
Begin MySuperMarket.FTextBox txtPW
Height = 300
Left = 1080
TabIndex = 2
Top = 1200
Width = 1995
_ExtentX = 3519
_ExtentY = 529
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
FontName = "宋体"
FontSize = 9
PasswordChar = "*"
AutoSelAll = -1 'True
End
Begin MySuperMarket.FTextBox txtDB
Height = 300
Left = 1080
TabIndex = 3
Top = 1680
Width = 3315
_ExtentX = 5847
_ExtentY = 529
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
FontName = "宋体"
FontSize = 9
AutoSelAll = -1 'True
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "数据库:"
Height = 180
Left = 240
TabIndex = 11
Top = 1755
Width = 720
End
Begin VB.Label lbPW
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "(密码已隐藏)"
Height = 180
Left = 3240
TabIndex = 10
Top = 1275
Visible = 0 'False
Width = 1080
End
Begin VB.Label lbCT
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "测试连接中..."
ForeColor = &H00FF0000&
Height = 180
Left = 240
TabIndex = 9
Top = 2295
Visible = 0 'False
Width = 1170
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密 码:"
Height = 180
Left = 240
TabIndex = 8
Top = 1275
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "服务器:"
Height = 180
Left = 240
TabIndex = 7
Top = 315
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名:"
Height = 180
Left = 240
TabIndex = 6
Top = 795
Width = 720
End
End
Attribute VB_Name = "frmServer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
On Error GoTo aaaa
If txtServer.Text = "" Then
MsgBox "必须填写 SQL 服务器名称或 IP 地址。", vbInformation
txtServer.SetFocus
Exit Sub
End If
If txtUser.Text = "" Then
MsgBox "必须填写 SQL 服务器的用户名。", vbInformation
txtUser.SetFocus
Exit Sub
End If
If txtDB.Text = "" Then
MsgBox "必须填写数据库的名称。", vbInformation
txtDB.SetFocus
Exit Sub
End If
lbCT.Visible = True
DoEvents
Dim cnTest As New ADODB.Connection
sqlConnect cnTest, txtServer.Text, txtUser.Text, txtPW.Text, txtDB.Text
MsgBox "连接 " & txtServer.Text & " 成功!", vbInformation
cnTest.Close
SaveServer txtServer.Text, txtUser.Text, txtPW.Text, txtDB.Text
readServer
Unload Me
Exit Sub
aaaa:
MsgBox Err.Description, vbCritical
lbCT.Visible = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -