用户登陆.frm
来自「VB的图书馆管理系统.管理员的帐号和密码都是」· FRM 代码 · 共 138 行
FRM
138 行
VERSION 5.00
Begin VB.Form Form01
Caption = "用户登陆"
ClientHeight = 2145
ClientLeft = 60
ClientTop = 450
ClientWidth = 4125
LinkTopic = "Form1"
ScaleHeight = 2145
ScaleWidth = 4125
StartUpPosition = 3 '窗口缺省
Begin VB.PictureBox Picture1
Height = 1455
Left = 240
ScaleHeight = 1395
ScaleWidth = 3555
TabIndex = 2
Top = 120
Width = 3615
Begin VB.OptionButton Option2
Caption = "管理员"
Height = 255
Left = 1920
TabIndex = 8
Top = 1080
Width = 855
End
Begin VB.OptionButton Option1
Caption = "普通用户"
Height = 255
Left = 480
TabIndex = 7
Top = 1080
Value = -1 'True
Width = 1095
End
Begin VB.TextBox Text2
DataField = "密码"
DataSource = "Data1"
Height = 375
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 4
Top = 600
Width = 2055
End
Begin VB.TextBox Text1
DataField = "卡号"
DataSource = "Data1"
Height = 375
Left = 1200
TabIndex = 3
Top = 120
Width = 2055
End
Begin VB.Label Label2
Caption = "密码:"
Height = 375
Left = 240
TabIndex = 6
Top = 600
Width = 975
End
Begin VB.Label Label1
Caption = "用户名:"
Height = 375
Left = 240
TabIndex = 5
Top = 120
Width = 975
End
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2160
TabIndex = 1
Top = 1680
Width = 855
End
Begin VB.CommandButton Command1
Caption = "登录"
Height = 375
Left = 600
TabIndex = 0
Top = 1680
Width = 975
End
End
Attribute VB_Name = "Form01"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim ac As String
Dim ar As New ADODB.Recordset
Dim acd As New ADODB.Connection
acd.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\图书馆.mdb"
If Trim(Text1.Text) = "" Or Trim(Text2.Text) = "" Then
MsgBox "用户名或密码为空,请重新输入"
Text1.SetFocus
Else
ac = "select * from 密码 where 用户名='" & Trim(Text1.Text) & "'"
ar.Open ac, acd
If ar.EOF = True Then
MsgBox "用户名不存在,请重新输入", vbOKOnly + vbExclamation
Text1.Text = ""
Text1.SetFocus
Else
username = Text1.Text
If Trim(ar.Fields(1)) = Trim(Text2.Text) And Trim(ar.Fields(2)) = "管理员" And Option2.Value = True Then
Unload Me
Form02.Show
ElseIf Trim(ar.Fields(1)) = Trim(Text2.Text) And Trim(ar.Fields(2)) = "普通用户" And Option1.Value = True Then
Unload Me
Form02.Show
Form02.RD.Enabled = False
Form02.B.Enabled = False
Form02.U1.Enabled = False
Else
MsgBox "密码不正确,请重新输入"
Text2.Text = ""
Text2.SetFocus
End If
End If
End If
End Sub
Private Sub Command2_Click()
End
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?