📄 frmnetset.frm
字号:
VERSION 5.00
Object = "{74848F95-A02A-4286-AF0C-A3C755E4A5B3}#1.0#0"; "actskn43.ocx"
Begin VB.Form frmnetset
Caption = "网络配置"
ClientHeight = 3900
ClientLeft = 60
ClientTop = 345
ClientWidth = 5745
LinkTopic = "Form1"
ScaleHeight = 3900
ScaleWidth = 5745
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 3015
Left = -120
TabIndex = 2
Top = 0
Width = 6495
Begin VB.TextBox txtserver
Height = 375
Left = 2880
TabIndex = 9
Top = 360
Width = 2175
End
Begin VB.TextBox txtlogin
Height = 375
Left = 2880
TabIndex = 7
Top = 1080
Width = 2175
End
Begin VB.TextBox txtpw
Height = 375
Left = 2880
TabIndex = 5
Top = 1800
Width = 2175
End
Begin VB.ComboBox cbodatabase
Height = 300
Left = 2880
TabIndex = 3
Top = 2520
Width = 2175
End
Begin ACTIVESKINLibCtl.Skin sknnetset
Left = 5280
OleObjectBlob = "frmnetset.frx":0000
Top = 1680
End
Begin ACTIVESKINLibCtl.SkinLabel lbldatabase
Height = 375
Left = 240
OleObjectBlob = "frmnetset.frx":0234
TabIndex = 4
Top = 2520
Width = 1215
End
Begin ACTIVESKINLibCtl.SkinLabel lblpw
Height = 375
Left = 240
OleObjectBlob = "frmnetset.frx":029A
TabIndex = 6
Top = 1800
Width = 1455
End
Begin ACTIVESKINLibCtl.SkinLabel lbllogin
Height = 495
Left = 240
OleObjectBlob = "frmnetset.frx":0300
TabIndex = 8
Top = 1080
Width = 1335
End
Begin ACTIVESKINLibCtl.SkinLabel lblserver
Height = 375
Left = 240
OleObjectBlob = "frmnetset.frx":0364
TabIndex = 10
Top = 360
Width = 1455
End
End
Begin VB.CommandButton cmdok
Caption = "确定"
Height = 495
Left = 600
TabIndex = 1
Top = 3240
Width = 1335
End
Begin VB.CommandButton cmdcancel
Caption = "取消"
Height = 495
Left = 3960
TabIndex = 0
Top = 3240
Width = 1215
End
End
Attribute VB_Name = "frmnetset"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim netcnn As New Connection '定义一个连接变量
Dim netcom As New Command
Dim netrst As New Recordset
Dim strServer As String '服务器参数
Dim strLogin As String '登陆名参数
Dim strPassword As String '密码参数
Dim strDatabase As String '数据库参数
Private Sub cbodatabase_DropDown() '选择后台数据库
If txtserver.Text = "" Or txtlogin.Text = "" Then
MsgBox "请完整填写配置信息", vbInformation, "网络配置!"
txtserver.SetFocus
Else
On Error GoTo errcheck
With netcnn
.ConnectionString = "User ID = " & txtlogin.Text & ";Password =" & txtpw.Text & " ;Data Source = " & txtserver.Text & "; Initial Catalog = master"
.Provider = "SQLOLEDB.1"
.Open
End With
netcom.ActiveConnection = netcnn
netrst.Open "select name from sysdatabases", netcnn, adOpenDynamic, adLockOptimistic
cbodatabase.Clear
While Not netrst.EOF
cbodatabase.AddItem netrst("name")
netrst.MoveNext
Wend
netcnn.Close
Set netcnn = Nothing
End If
Exit Sub
errcheck:
MsgBox Err.Description, vbInformation, "网络配置"
End Sub
Private Sub cmdcancel_Click()
End
End Sub
Private Sub cmdok_Click() '保存配置信息
If cbodatabase.Text = "" Then
MsgBox "数据库不能为空!", vbInformation, "网络配置"
Else
SaveSetting App.EXEName, "DB Config", "SeverHost", txtserver.Text
SaveSetting App.EXEName, "DB Config", "UserID", txtlogin.Text
SaveSetting App.EXEName, "DB Config", "PassWord", txtpw.Text
SaveSetting App.EXEName, "DB Config", "Initial Catalog", cbodatabase.Text
strServer = Trim(txtserver.Text)
strLogin = Trim(txtlogin.Text)
strPassword = Trim(txtpw.Text)
strDatabase = Trim(cbodatabase.Text)
Load frmLogin
frmLogin.Show
Unload Me
End If
End Sub
Private Sub Form_Load()
Call changeskin(Me, sknnetset, strSkin)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -