📄 frm_login.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Frm_login
BorderStyle = 1 'Fixed Single
Caption = "系统登录"
ClientHeight = 2550
ClientLeft = 45
ClientTop = 330
ClientWidth = 4500
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
Picture = "Frm_login.frx":0000
ScaleHeight = 2550
ScaleWidth = 4500
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 75
Top = 2700
Width = 2100
_ExtentX = 3704
_ExtentY = 582
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=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_xsdp;Data Source=."
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_xsdp;Data Source=."
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from tb_jbxx"
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.TextBox Text2
Height = 345
IMEMode = 3 'DISABLE
Left = 2535
PasswordChar = "*"
TabIndex = 1
Top = 1380
Width = 1770
End
Begin VB.TextBox Text1
Height = 345
Left = 2535
TabIndex = 0
Top = 915
Width = 1770
End
Begin VB.Image Image2
Height = 300
Left = 3255
Top = 1815
Width = 675
End
Begin VB.Image Image1
Height = 300
Left = 2190
Top = 1830
Width = 675
End
End
Attribute VB_Name = "Frm_login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
Private Sub Image1_Click()
Static intMyTimes As Integer
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Frm_main.StatusBar1.Panels(4).Text = Text1.Text
rs1.Open "tb_stu", cnn, adOpenStatic, , adCmdTable
If Text1.Text = "" And Text2.Text = "" Then
MsgBox "用户名或密码不能为空!", , "系统提示"
Exit Sub
End If
rs2.Open "tb_gly where 管理员='" & Text1.Text & "' and 密码='" & Text2.Text & "'", cnn, adOpenKeyset, adLockOptimistic
If rs2.RecordCount < 1 Then
intMyTimes = intMyTimes + 1
If intMyTimes = 4 Then
MsgBox "登录错误超过3次,系统自动退出!", , "系统提示"
End
End If
MsgBox "登录错误!", , "系统提示"
Text2.Text = ""
Else
If rs2.RecordCount = 1 Then
Frm_main.Show '通过身份验证则显示主窗体,登录到系统当中
Unload Me
Unload Me
Frm_main.Show
End If
End If
rs1.Close
rs2.Close
End Sub
Private Sub Image2_Click()
If MsgBox("是否退出系统!", vbOKCancel + vbQuestion, "系统提示") = vbOK Then
End
End If
End Sub
Private Sub text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Image1_Click '按回车键Image1获得焦点
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text2.SetFocus '按回车键,text2获得焦点
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -