📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmLogin
BorderStyle = 1 'Fixed Single
Caption = "登录"
ClientHeight = 6330
ClientLeft = 45
ClientTop = 330
ClientWidth = 9180
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frmLogin.frx":0000
ScaleHeight = 6330
ScaleWidth = 9180
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox txtpassword
Height = 495
IMEMode = 3 'DISABLE
Left = 4800
PasswordChar = "*"
TabIndex = 6
Top = 3240
Width = 2655
End
Begin VB.TextBox txtuserid
Height = 495
Left = 4800
TabIndex = 5
Top = 2160
Width = 2655
End
Begin MSAdodcLib.Adodc adouser
Height = 375
Left = 240
Top = 240
Visible = 0 'False
Width = 1935
_ExtentX = 3413
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
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 VB.CommandButton Command2
Caption = "取消"
BeginProperty Font
Name = "新宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5880
TabIndex = 4
Top = 4800
Width = 1815
End
Begin VB.CommandButton Command1
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1200
TabIndex = 3
Top = 4800
Width = 1815
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "用户密码"
BeginProperty Font
Name = "隶书"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1200
TabIndex = 2
Top = 3240
Width = 2175
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "用 户 名"
BeginProperty Font
Name = "隶书"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1200
TabIndex = 1
Top = 2160
Width = 2055
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "学生信息管理系统"
BeginProperty Font
Name = "幼圆"
Size = 36
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 975
Left = 1680
TabIndex = 0
Top = 600
Width = 6015
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rs As ADODB.Recordset
Private Sub Command1_Click()
Static interr As Integer
adouser.Refresh
Set rs = adouser.Recordset
rs.Find "用户名='" & txtuserid.Text & "'"
If Not rs.EOF Then '若用户名正确
'检查密码
If rs("密码") = txtpassword.Text Then '若密码正确
gstruser = txtuserid.Text '存在用户
If rs("权限") = "管理员" Then '存用户权限
gblnpurview = True
Else
gblnpurview = False
End If
frmMain.Show
Unload Me
Else
interr = interr + 1
If interr = 3 Then
Set rs = Nothing
Unload Me
Else
MsgBox "密码输入错误,请重新输入!", vbExclamation
With txtpassword '焦点返回密码框
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End With
End If
End If
Else
interr = interr + 1
If interr = 3 Then
Set rs = Nothing
Unload Me
Else
MsgBox "用户名输入错误,请重新输入!", vbExclamation
With txtuserid
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End With
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Initialize()
ChDrive App.Path
ChDir App.Path
End Sub
Private Sub Form_Load()
Command1.Default = True
Dim sql As String
sql = "select * from 用户"
adouser.RecordSource = sql
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -