📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 1 'Fixed Single
Caption = "登录"
ClientHeight = 3630
ClientLeft = 45
ClientTop = 330
ClientWidth = 5100
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3630
ScaleWidth = 5100
Begin VB.CommandButton cmdCancel
Caption = "取 消"
Height = 495
Left = 2880
TabIndex = 6
Top = 2880
Width = 1215
End
Begin VB.CommandButton cmdLogin
Caption = "登 录"
Height = 495
Left = 840
TabIndex = 5
Top = 2880
Width = 1215
End
Begin VB.Frame fraLogin
Height = 1935
Left = 360
TabIndex = 0
Top = 720
Width = 4455
Begin VB.TextBox txtPwd
Height = 375
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 4
Top = 1200
Width = 2175
End
Begin VB.TextBox txtUser
Height = 375
Left = 1320
TabIndex = 3
Top = 480
Width = 2175
End
Begin VB.Label lblPwd
Caption = "用户密码:"
Height = 375
Left = 240
TabIndex = 2
Top = 1200
Width = 975
End
Begin VB.Label lblUser
Caption = "用户名称:"
Height = 375
Left = 240
TabIndex = 1
Top = 480
Width = 975
End
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "销售管理信息系统"
BeginProperty Font
Name = "华文彩云"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 480
TabIndex = 7
Top = 120
Width = 4335
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdLogin_Click()
'首先检查用户是否输入了用户名和密码
If txtUser.Text = "" Then
MsgBox "请输入用户名!", vbOKOnly + vbInformation, "注意"
txtUser.SetFocus
Exit Sub
ElseIf txtPwd.Text = "" Then
MsgBox "请输入密码!", vbOKOnly + vbInformation, "注意"
txtPwd.SetFocus
Exit Sub
End If
Dim rstUser As New ADODB.Recordset
Dim sql As String
sql = "select * from userdb where 用户名 = '" & txtUser.Text & "' and " _
& " 密码= '" & txtPwd.Text & "'"
rstUser.Open sql, conn, adOpenKeyset, adLockPessimistic
If rstUser.EOF = True Then
MsgBox "用户名或密码错误,无法登录", vbOKOnly + vbInformation, ""
rstUser.Close
Exit Sub
Else
MsgBox "正确登录", vbOKOnly + vbExclamation, ""
'打开窗体
MDIfrmMain.mnadduser.Enabled = True
MDIfrmMain.mnchpwd.Enabled = True
MDIfrmMain.mntrade.Enabled = True
MDIfrmMain.mnbuy.Enabled = True
MDIfrmMain.mnsell.Enabled = True
MDIfrmMain.mngrade.Enabled = True
MDIfrmMain.mntable.Enabled = True
rstUser.Close
Unload Me
End If
End Sub
Private Sub Form_Load()
Call MakeCenter(Me)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -