📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form FrmLogin
BorderStyle = 0 'None
Caption = "身份验证"
ClientHeight = 5820
ClientLeft = 0
ClientTop = 0
ClientWidth = 7635
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5820
ScaleWidth = 7635
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Cmdcancel
BackColor = &H00FFFF80&
Caption = "取消"
BeginProperty Font
Name = "隶书"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3840
Style = 1 'Graphical
TabIndex = 7
Top = 3240
Width = 1215
End
Begin VB.CommandButton Cmdok
BackColor = &H00FFFF80&
Caption = "登陆"
DisabledPicture = "FrmLogin.frx":0000
BeginProperty Font
Name = "隶书"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 960
MaskColor = &H00C0FFC0&
Style = 1 'Graphical
TabIndex = 6
Top = 3240
Width = 1215
End
Begin VB.Frame Frame1
BackColor = &H00808000&
ForeColor = &H00808000&
Height = 3975
Left = 120
TabIndex = 0
Top = 120
Width = 5775
Begin VB.ComboBox Combo1
Height = 300
ItemData = "FrmLogin.frx":BAE8
Left = 2280
List = "FrmLogin.frx":BAF2
TabIndex = 11
Text = "Combo1"
Top = 480
Width = 1575
End
Begin VB.TextBox txtUsername
Height = 495
Left = 2160
TabIndex = 9
Top = 1200
Width = 1815
End
Begin VB.PictureBox Picture1
Appearance = 0 'Flat
BackColor = &H008080FF&
ForeColor = &H80000008&
Height = 375
Left = 1680
Picture = "FrmLogin.frx":BB06
ScaleHeight = 345
ScaleWidth = 345
TabIndex = 5
Top = 2520
Width = 375
End
Begin VB.TextBox txtPassword
Height = 495
IMEMode = 3 'DISABLE
Left = 2160
PasswordChar = "*"
TabIndex = 3
Top = 1800
Width = 1815
End
Begin VB.Label Label5
BackColor = &H00808000&
Caption = "用户权限"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 495
Left = 480
TabIndex = 10
Top = 480
Width = 1215
End
Begin VB.Label Label3
BackColor = &H00808000&
Caption = "请仔细填写!"
BeginProperty Font
Name = "隶书"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 495
Left = 2400
TabIndex = 4
Top = 2520
Width = 1935
End
Begin VB.Label Label2
BackColor = &H00808000&
Caption = "密码"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 495
Left = 600
TabIndex = 2
Top = 1920
Width = 1215
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H00808000&
Caption = "用户名"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 615
Left = 480
TabIndex = 1
Top = 1200
Width = 1095
End
End
Begin VB.Label Label4
Caption = "Label4"
Height = 495
Left = 2640
TabIndex = 8
Top = 2160
Width = 1215
End
End
Attribute VB_Name = "FrmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public loginsucceeded As Boolean
Private Sub Cmdcancel_Click()
Unload Me
End Sub
Private Sub Cmdok_Click()
Dim rs As ADODB.Recordset
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.ConnectionString = "fileDSN=mawen.dsn"
conn.Open
Set rs = New ADODB.Recordset
If Combo1.Text = "" Or txtUsername.Text = "" Or txtPassword.Text = "" Then
MsgBox "权限,用户编号,密码都必须填写", vbOKOnly + vbExclamation, "系统警告"
Else
SQL = "select UserName from Users where UserName='" & Trim(txtUsername.Text) & "'"
rs.Open Trim(SQL), conn, adOpenKeyset, adLockPessimistic
If rs.EOF = True Then
MsgBox "你输入的用户名不存在", vbOKOnly + vbExclamation, "系统警告"
txtUsername.Text = ""
txtPassword.Text = ""
txtUsername.SetFocus
Else
SQL = "select Pwd from Users where UserName='" & Trim(txtUsername.Text) & "' "
rs.Close
rs.Open Trim(SQL), conn, adOpenKeyset, adLockPessimistic
If Trim(rs.Fields(0)) <> Trim(txtPassword.Text) Then
MsgBox "您输入的密码不正确或用户编号有错误!", vbOKOnly + vbExclamation, "系统提示"
txtUsername.Text = ""
txtPassword.Text = ""
txtUsername.SetFocus
ElseIf Trim(rs.Fields(0)) = Trim(txtPassword.Text) Then
conn.Close
Set conn = Nothing
Set rs = Nothing
'User = Trim(txtUsername.Text)
' quanxian = Trim(Combo1.Text)
Unload Me
MDIForm1.Show
End If
End If
End If
End Sub
Private Sub Form_Load()
loginsucceeded = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -