📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Frm_login
BackColor = &H00FF8080&
BorderStyle = 1 'Fixed Single
ClientHeight = 2085
ClientLeft = 15
ClientTop = -90
ClientWidth = 3960
ControlBox = 0 'False
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2085
ScaleWidth = 3960
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 840
Top = 1920
Visible = 0 'False
Width = 1935
_ExtentX = 3413
_ExtentY = 582
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= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=CarSaleSys"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "CarSaleSys"
OtherAttributes = ""
UserName = "sa"
Password = "sa"
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Frame Frame1
BackColor = &H00FF8080&
Caption = "轿车销售系统欢迎你"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 1215
Left = 240
TabIndex = 4
Top = 0
Width = 3495
Begin VB.TextBox txtUser
Appearance = 0 'Flat
BackColor = &H00FF8080&
Height = 270
Left = 1080
MaxLength = 20
TabIndex = 0
ToolTipText = "输入用户名,不超过20个字符"
Top = 315
Width = 2175
End
Begin VB.TextBox txtPwd
Appearance = 0 'Flat
BackColor = &H00FF8080&
Height = 270
IMEMode = 3 'DISABLE
Left = 1080
MaxLength = 20
PasswordChar = "*"
TabIndex = 1
ToolTipText = "输入密码,不超过20个字符"
Top = 795
Width = 2175
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密 码"
BeginProperty Font
Name = "仿宋_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Left = 240
TabIndex = 6
Top = 840
Width = 675
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名"
BeginProperty Font
Name = "仿宋_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Left = 240
TabIndex = 5
Top = 360
Width = 675
End
End
Begin VB.CommandButton Cmd_Ok
BackColor = &H00FF8080&
Caption = "确 定"
Default = -1 'True
BeginProperty Font
Name = "新宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 400
Left = 437
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 2
Top = 1440
Width = 1300
End
Begin VB.CommandButton Cmd_Cancel
BackColor = &H00FF8080&
Cancel = -1 'True
Caption = "取 消"
BeginProperty Font
Name = "新宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 400
Left = 2237
MousePointer = 99 'Custom
Style = 1 'Graphical
TabIndex = 3
Top = 1440
Width = 1300
End
End
Attribute VB_Name = "Frm_login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public PasswordKey As String
Public NameKey As String
Public Try_times As Integer
Private Sub Cmd_Cancel_Click()
End
End Sub
Private Sub Cmd_OK_Click()
Dim j As Single
'数据有效性检查
If txtUser = "" Then
MsgBox "请输入用户名"
txtUser.SetFocus
Exit Sub
End If
If txtPwd = "" Then
MsgBox "请输入密码"
txtPwd.SetFocus
Exit Sub
End If
'将用户输入赋值到变量中
NameKey = Trim(txtUser.Text)
PasswordKey = Trim(txtPwd.Text)
'判断用户是否存在
Adodc1.RecordSource = "select * from Users where User_name = '" + NameKey + "'"
Adodc1.Refresh
If Adodc1.Recordset.EOF = True Then
MsgBox "用户名不存在"
Try_times = Try_times + 1
If Try_times >= 3 Then
MsgBox "您已经三次尝试进入本系统,均不成功,系统将关闭"
Exit Sub
Else
Exit Sub
End If
End If
'判断密码是否正确
If PasswordKey <> Adodc1.Recordset.Fields(1) Then
MsgBox "密码错误"
Try_times = Try_times + 1
If Try_times >= 3 Then
MsgBox "您已经三次尝试进入本系统,均不成功,系统将关闭"
Exit Sub
Else
Exit Sub
End If
End If
'登录成功,设置权限
If Adodc1.Recordset.Fields(2) = 1 Then
FormMain.Menu_addCar.Enabled = False
FormMain.Menu_addCus.Enabled = False
FormMain.Menu_addEmp.Enabled = False
FormMain.Menu_addUser.Enabled = False
Frm_edit_Car.Cmd_del.Enabled = False
Frm_edit_Car.Cmd_modi.Enabled = False
Frm_edit_Cus.Cmd_del.Enabled = False
Frm_edit_Cus.Cmd_modi.Enabled = False
Frm_edit_Emp.Cmd_del.Enabled = False
Frm_edit_Emp.Cmd_modi.Enabled = False
FormMain.Menu_edit_User.Enabled = False
ElseIf Adodc1.Recordset.Fields(2) <> 0 Then
MsgBox ("用户类型错误")
Exit Sub
End If
'关闭登录对话框
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -