📄 form1.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Login
Caption = "管理员登录"
ClientHeight = 4410
ClientLeft = 60
ClientTop = 465
ClientWidth = 6105
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4410
ScaleWidth = 6105
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Textime
Height = 375
Left = 4320
TabIndex = 7
Text = "Text2"
Top = 2160
Visible = 0 'False
Width = 735
End
Begin VB.TextBox Text1
Height = 375
IMEMode = 3 'DISABLE
Left = 1080
MaxLength = 6
PasswordChar = "*"
TabIndex = 1
Top = 3840
Width = 1455
End
Begin VB.CommandButton CmdEND
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4800
TabIndex = 3
Top = 3720
Width = 855
End
Begin VB.CommandButton CmdOK
Caption = "确认"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3480
TabIndex = 2
Top = 3720
Width = 855
End
Begin MSComctlLib.ListView ListView1
Height = 2535
Left = 240
TabIndex = 0
Top = 480
Width = 5655
_ExtentX = 9975
_ExtentY = 4471
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
Icons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
Begin MSAdodcLib.Adodc Adodc1
Height = 495
Left = 960
Top = 2040
Width = 1695
_ExtentX = 2990
_ExtentY = 873
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=CARS"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "CARS"
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 MSComctlLib.ImageList ImageList1
Left = 2760
Top = 2160
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 2
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":7D42
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":A060
Key = ""
EndProperty
EndProperty
End
Begin VB.Label qx
Height = 255
Left = 4320
TabIndex = 11
Top = 3240
Width = 1575
End
Begin VB.Label Label4
Caption = "权限:"
Height = 255
Left = 3480
TabIndex = 10
Top = 3240
Width = 615
End
Begin VB.Label czy
BackStyle = 0 'Transparent
Height = 255
Left = 1200
TabIndex = 9
Top = 3240
Width = 1335
End
Begin VB.Label bh
BackStyle = 0 'Transparent
Height = 255
Left = 3960
TabIndex = 8
Top = 3240
Width = 615
End
Begin VB.Label Label3
Caption = "密码:"
Height = 255
Left = 240
TabIndex = 6
Top = 3840
Width = 855
End
Begin VB.Label Label2
Caption = "操作员:"
Height = 255
Left = 240
TabIndex = 5
Top = 3240
Width = 735
End
Begin VB.Label Label1
Caption = "在下面选择用来登陆的身份:"
Height = 255
Left = 240
TabIndex = 4
Top = 120
Width = 2415
End
End
Attribute VB_Name = "Login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim itmX As ListItem
Dim TIM As Integer
Dim key, list As String
Dim key1 As Integer
Private Sub CmdEND_Click()
End
End Sub
Private Sub CmdOK_Click()
Dim MESSAGE As String
Dim MESSAGE1 As String
Textime.Text = TIM
Adodc1.RecordSource = "select * from 权限信息表 where 操作员名称= '" + Trim(czy.Caption) + "'"
Adodc1.Refresh
If qx.Caption = "总经理" Then
key1 = 1
End If
If qx.Caption = "入库管理员" Then
key1 = 2
End If
If qx.Caption = "销售管理员" Then
key1 = 3
End If
If qx.Caption = "系统管理员" Then
key1 = 4
End If
If qx.Caption <> "" And Text1.Text = Trim(Adodc1.Recordset.Fields("密码")) Then
MESSAGE1 = MsgBox("登录成功!", 0, "")
If MESSAGE1 = vbOK Then
frmMain.StatusBar1.Panels.Item(2) = "当前操作员: " + Trim(czy.Caption)
If key1 = 1 Then
frmMain.mncarsell_find.Enabled = True
frmMain.mnwarehouse_find.Enabled = True
frmMain.mncarsell_find1.Enabled = True
frmMain.mnsellday.Enabled = True
frmMain.mnsellmonth.Enabled = True
frmMain.mncar_style.Enabled = True
frmMain.mncustomer.Enabled = True
frmMain.mnoperator.Enabled = False
frmMain.mnsale.Enabled = False
frmMain.mnin.Enabled = False
End If
If key1 = 2 Then
frmMain.mncarsell_find.Enabled = False
frmMain.mncarsell_find1.Enabled = False
frmMain.mnsellday.Enabled = False
frmMain.mnsellmonth.Enabled = False
frmMain.mncustomer.Enabled = False
frmMain.mnoperator.Enabled = False
frmMain.mnsale.Enabled = False
End If
If key1 = 3 Then
frmMain.mnwarehouse_find.Enabled = False
frmMain.mncar_style.Enabled = False
frmMain.mnoperator.Enabled = False
frmMain.mnin.Enabled = False
End If
If key1 = 4 Then
frmMain.mncarsell_find.Enabled = False
frmMain.mnwarehouse_find.Enabled = False
frmMain.mncarsell_find1.Enabled = False
frmMain.mnsellday.Enabled = False
frmMain.mnsellmonth.Enabled = False
frmMain.mncar_style.Enabled = False
frmMain.mncustomer.Enabled = False
frmMain.mnsale.Enabled = False
frmMain.mnin.Enabled = False
End If
End If
Load frmMain
frmMain.Show
Unload Login
Else
If TIM = 3 Then
MESSAGE = MsgBox("您的密码输入错误次数以达最大,请向系统管理员查询!", 0, "")
If MESSAGE = vbOK Then
End
End If
End If
If czy.Caption = "" Then
MsgBox ("请选择操作员!")
ListView1.SetFocus
Else
If Text1.Text <> Adodc1.Recordset.Fields("密码") Then
MsgBox ("密码错误,请重新输入密码!")
TIM = TIM + 1
Text1.Text = ""
Text1.SetFocus
End If
End If
End If
End Sub
Private Sub Form_Load()
Adodc1.RecordSource = "select * from 权限信息表"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
czy.Caption = Trim(Adodc1.Recordset.Fields("操作员名称"))
qx.Caption = Trim(Adodc1.Recordset.Fields("权限"))
Do While Adodc1.Recordset.EOF = False
key = Trim(Adodc1.Recordset.Fields("操作员名称"))
Set itmX = ListView1.ListItems.Add(, , key, 1)
Adodc1.Recordset.MoveNext
Loop
End If
End Sub
Private Sub ListView1_Click()
If ListView1.ListItems.Count > 0 Then
list = ListView1.SelectedItem
Adodc1.RecordSource = "select * from 权限信息表 where 操作员名称='" & list & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
czy.Caption = Trim(Adodc1.Recordset.Fields("操作员名称"))
qx.Caption = Trim(Adodc1.Recordset.Fields("权限"))
End If
End If
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
CmdOK.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -