📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "Login"
ClientHeight = 2985
ClientLeft = 30
ClientTop = 330
ClientWidth = 4665
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2985
ScaleWidth = 4665
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Tag = "Login"
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 0
Top = 2640
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
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 cmdCancel
Cancel = -1 'True
Caption = "Cancel"
Height = 360
Left = 2340
TabIndex = 5
Tag = "Cancel"
Top = 1944
Width = 1140
End
Begin VB.CommandButton cmdOK
Caption = "OK"
Default = -1 'True
Height = 360
Left = 732
TabIndex = 4
Tag = "OK"
Top = 1944
Width = 1140
End
Begin VB.TextBox txtPassword
Height = 288
IMEMode = 3 'DISABLE
Left = 1548
PasswordChar = "*"
TabIndex = 2
Top = 1452
Width = 2325
End
Begin VB.TextBox txtUserName
Height = 288
Left = 1548
TabIndex = 1
Top = 1056
Width = 2325
End
Begin VB.Label Label1
BackColor = &H80000000&
Caption = "人事管理信息系统"
BeginProperty Font
Name = "华文彩云"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000001&
Height = 375
Left = 840
TabIndex = 6
Top = 240
Width = 3015
End
Begin VB.Label lblLabels
Caption = "密码"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Index = 1
Left = 348
TabIndex = 0
Tag = "&Password:"
Top = 1464
Width = 1080
End
Begin VB.Label lblLabels
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Index = 0
Left = 348
TabIndex = 3
Tag = "&User Name:"
Top = 1080
Width = 1080
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Public OK As Boolean
Private Sub Form_Load()
Dim sBuffer As String
Dim lSize As Long
Adodc1.ConnectionString = Cnn
Adodc1.RecordSource = "select * from 用户信息"
Adodc1.Refresh
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim txtSQL As String
Dim MsgText As String
Dim i As Integer
If txtUserName.Text = "" Then
MsgBox "请输入用户名!"
txtUserName.SetFocus
Else
If txtPassword.Text = "" Then
MsgBox "请输入密码!"
txtPassword.SetFocus
Else
txtSQL = "select * from 用户信息 where 用户名 = '" & Trim(txtUserName.Text) & "' and 用户密码 = '" & Trim(txtPassword.Text) & "'"
Adodc1.RecordSource = txtSQL
Adodc1.Refresh
On Error GoTo 1
If Trim(Adodc1.Recordset.Fields(0)) = txtUserName.Text And Trim(Adodc1.Recordset.Fields(1)) = txtPassword.Text Then
save_name = Trim(txtUserName.Text)
For i = 0 To 7
QX(i) = Adodc1.Recordset.Fields(2 + i)
Next i
frm_main.Show
Unload Me
Else
MsgBox "用户名或密码错误!"
txtUserName.Text = ""
txtPassword.Text = ""
txtUserName.SetFocus
End If
End If
End If
GoTo 2
1:
MsgBox "用户名或密码错误!"
txtUserName.Text = ""
txtPassword.Text = ""
txtUserName.SetFocus
2:
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -