📄 frmsysini.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmsysini
Caption = "糸统初始化窗体"
ClientHeight = 4545
ClientLeft = 60
ClientTop = 450
ClientWidth = 6285
LinkTopic = "Form1"
ScaleHeight = 4545
ScaleWidth = 6285
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox txtpassword
BackColor = &H00C0E0FF&
Height = 375
Left = 2400
TabIndex = 9
Top = 3000
Width = 2535
End
Begin VB.TextBox txtuser
BackColor = &H00C0E0FF&
Height = 375
Left = 2400
TabIndex = 8
Top = 2160
Width = 2535
End
Begin VB.TextBox txtserver
BackColor = &H00C0E0FF&
Height = 375
Left = 2400
TabIndex = 7
Top = 1320
Width = 2535
End
Begin VB.TextBox Text1
Height = 375
Left = 2280
TabIndex = 6
Text = "Text1"
Top = 120
Visible = 0 'False
Width = 2535
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 240
Top = 120
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=ERP"
OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=ERP"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from users"
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 cmdBack
Caption = "返回"
Height = 375
Left = 4200
TabIndex = 4
Top = 4080
Width = 1335
End
Begin VB.CommandButton cmdSet
Caption = "设定"
Height = 375
Left = 2400
TabIndex = 3
Top = 4080
Width = 1335
End
Begin VB.CommandButton cmdRead
Caption = "读取"
Height = 375
Left = 600
TabIndex = 2
Top = 4080
Width = 1335
End
Begin VB.Label Label3
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "密码:"
BeginProperty Font
Name = "隶书"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 5
Top = 3000
Width = 1695
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "用户名:"
BeginProperty Font
Name = "隶书"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 1
Top = 2160
Width = 1695
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "服务器名:"
BeginProperty Font
Name = "隶书"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 0
Top = 1320
Width = 1695
End
End
Attribute VB_Name = "frmsysini"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Function FileExist(fname As String) As Boolean
On Local Error Resume Next
FileExist = (Dir(fname) <> "")
End Function
Public Function GetKey(Tmp_file As String, Tmp_key As String) As String
Dim File As Long
File = FreeFile
If FileExist(Tmp_file) = False Then
GetKey = ""
Call WritePrivateProfileString("setup information", "server", "", App.Path + "\setup.ini")
Call WritePrivateProfileString("setup information", "username", "", App.Path + "\setup.ini")
Call WritePrivateProfileString("setup information", "password", "", App.Path + "\setup.ini")
Exit Function
End If
Open Tmp_file For Input As File
Do While Not EOF(1)
Line Input #File, buffer
If Left(buffer, Len(Tmp_key)) = Tmp_key Then
pos = InStr(buffer, "=")
GetKey = Trim(Mid(buffer, pos + 1))
End If
Loop
Close File
End Function
Private Sub cmdBack_Click()
Unload Me
End Sub
Private Sub cmdRead_Click()
server = GetKey(App.Path + "\setup.ini", "server")
UserName = GetKey(App.Path + "\setup.ini", "username")
Password = GetKey(App.Path + "\setup.ini", "password")
If server = "" Then
MsgBox "初始信息没有设置,请填入初始信息"
Else
txtserver.Text = server
txtuser.Text = UserName
txtpassword.Text = Password
End If
cmdSet.Enabled = True
cmdRead.Enabled = False
End Sub
Private Sub test()
Adodc1.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=ERP"
Adodc1.RecordSource = "select * from users"
Set Text1.DataSource = Adodc1
Text1.DataField = "name"
End Sub
Private Sub cmdSet_Click()
If txtserver.Text = "" Then
MsgBox "请填入服务器名称"
txtserver.SetFocus
Exit Sub
End If
Call WritePrivateProfileString("setup information", "server", txtserver.Text, App.Path + "\setup.ini")
Call WritePrivateProfileString("setup information", "username", txtuser.Text, App.Path + "\setup.ini")
Call WritePrivateProfileString("setup information", "password", txtpassword.Text, App.Path + "\setup.ini")
server = txtserver.Text
UserName = txtuser.Text
Password = txtpassword.Text
test
If Text1.Text <> "" Then
MsgBox "设置成功"
frmmanageuse.lbldatabasemanage.Enabled = True
frmmanageuse.lbldatabaseset.Enabled = True
frmmanageuse.lblusermanage.Enabled = True
Else
MsgBox "设置失败,设置参数与SQL服务器的参数不符,请重新设置"
txtserver.Text = ""
txtuser.Text = ""
txtpassword.Text = ""
txtserver.SetFocus
Exit Sub
End If
Unload Me
End Sub
Private Sub Form_Load()
frmsysini.BackColor = RGB(77, 116, 244)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -