📄 login_frm.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Login_frm
BorderStyle = 3 'Fixed Dialog
Caption = "登录"
ClientHeight = 6555
ClientLeft = 5205
ClientTop = 4875
ClientWidth = 10080
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3872.91
ScaleMode = 0 'User
ScaleWidth = 9464.573
ShowInTaskbar = 0 'False
Begin VB.PictureBox Picture1
Height = 1815
Left = 720
Picture = "Login_frm.frx":0000
ScaleHeight = 1755
ScaleWidth = 1635
TabIndex = 7
Top = 1680
Width = 1695
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 4080
Top = 4080
Visible = 0 'False
Width = 2040
_ExtentX = 3598
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
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=E:\VB实习\DB1.MDB;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\VB实习\DB1.MDB;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "pwd"
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 txtUserName
DataSource = "Adodc1"
Height = 345
Left = 4800
TabIndex = 0
Text = "1"
Top = 2760
Width = 2325
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Default = -1 'True
Height = 390
Left = 2760
TabIndex = 2
Top = 4440
Width = 1140
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "退出"
Height = 390
Left = 6240
TabIndex = 3
Top = 4440
Width = 1140
End
Begin VB.TextBox txtPassword
DataSource = "Adodc1"
Height = 345
IMEMode = 3 'DISABLE
Left = 4800
PasswordChar = "*"
TabIndex = 1
Text = "1"
Top = 3480
Width = 2325
End
Begin VB.Label Label5
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "学生信息管理系统"
BeginProperty Font
Name = "华文细黑"
Size = 23.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 615
Left = 2760
TabIndex = 6
Top = 1680
Width = 3855
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "用户密码:"
Height = 375
Left = 2760
TabIndex = 5
Top = 3360
Width = 1095
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "用户名:"
Height = 375
Left = 2760
TabIndex = 4
Top = 2760
Width = 1095
End
Begin VB.Image Image1
Height = 11520
Left = 0
Picture = "Login_frm.frx":1A9A
Top = 0
Width = 15360
End
End
Attribute VB_Name = "Login_frm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdCancel_Click()
End
End Sub
Private Sub cmdOK_Click()
Static error_count As Integer
If txtUserName.Text = "" And txtPassword.Text = "" Then
MsgBox "请输入用户名和密码", vbExclamation + vbOKOnly, "登陆提示"
txtUserName.SetFocus
Else
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from pwd where 用户名='" & txtUserName.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.EOF = True Then
MsgBox "用户名不正确,请您确认后重新输入", vbExclamation + vbOKOnly, "登陆提示"
txtUserName.Text = ""
txtUserName.SetFocus
Else
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from pwd where 用户名='" & txtUserName.Text & "' and 密码='" & txtPassword.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.EOF = True Then
error_count = error_count + 1
If error_count = 3 Then
MsgBox "您是非法用户,系统即将关闭", vbCritical + vbOKOnly, "登陆提示"
Unload Me
Else
MsgBox "密码不正确,请您确认后重新输入", vbExclamation + vbOKOnly, "登陆提示"
txtPassword.Text = ""
txtPassword.SetFocus
End If
Else
If Adodc1.Recordset!权限 = "学生" Then
qx = "学生"
UserName = txtUserName.Text
MsgBox "欢迎学生登陆!" & vbCrLf & vbCrLf & "你只有学生的权限!", vbInformation + vbOKOnly, "登陆提示"
' MDIForm1.sys.Enabled = False
Login_frm.Hide
MDIForm1.Show
' MDIForm1.Enabled = False
txtUserName.Text = ""
txtPassword.Text = ""
MDIForm1.student.Enabled = True
MDIForm1.s_choice.Enabled = True
MDIForm1.stchquery.Enabled = True
MDIForm1.help.Enabled = True
MDIForm1.user.Enabled = True
MDIForm1.Command1.Enabled = True
MDIForm1.denglu.Enabled = False
MDIForm1.teacher.Enabled = False
MDIForm1.course.Enabled = False
MDIForm1.t_choice.Enabled = False
MDIForm1.tequery.Enabled = False
MDIForm1.help.Enabled = False
MDIForm1.reports.Enabled = False
MDIForm1.Command2.Enabled = False
MDIForm1.Command3.Enabled = False
MDIForm1.Command4.Enabled = False
MDIForm1.Command5.Enabled = False
MDIForm1.user_manage.Enabled = False
ElseIf Adodc1.Recordset!权限 = "老师" Then
qx = "老师"
UserName = txtUserName.Text
MsgBox "欢迎教师登陆!" & vbCrLf & vbCrLf & "你只有教师的权限!", vbInformation + vbOKOnly, "登陆提示"
'MDIForm1.sys.Enabled = False
Login_frm.Hide
MDIForm1.Show
' MDIForm1.Enabled = False
txtUserName.Text = ""
txtPassword.Text = ""
MDIForm1.teacher.Enabled = True
MDIForm1.course.Enabled = True
MDIForm1.t_choice.Enabled = True
MDIForm1.tequery.Enabled = True
MDIForm1.help.Enabled = True
MDIForm1.user.Enabled = True
MDIForm1.Command2.Enabled = True
MDIForm1.Command3.Enabled = True
MDIForm1.denglu.Enabled = False
MDIForm1.student.Enabled = False
MDIForm1.s_choice.Enabled = False
MDIForm1.stchquery.Enabled = False
MDIForm1.help.Enabled = False
MDIForm1.help.Enabled = False
MDIForm1.reports.Enabled = False
MDIForm1.Command1.Enabled = False
MDIForm1.Command4.Enabled = False
MDIForm1.Command5.Enabled = False
MDIForm1.user_manage.Enabled = False
ElseIf Adodc1.Recordset!权限 = "管理员" Then
qx = "管理员"
UserName = txtUserName.Text
MsgBox "欢迎管理员登陆!" & vbCrLf & vbCrLf & "你有所有的权限!", vbInformation + vbOKOnly, "登陆提示"
Login_frm.Hide
MDIForm1.Show
' MDIForm1.Enabled = False
txtUserName.Text = ""
txtPassword.Text = ""
End If
End If
End If
End If
End Sub
Private Sub Form_Load()
Dim con As ADODB.Connection
Dim nPath As String
nPath = App.Path
Set con = New ADODB.Connection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & nPath & "\db1.mdb;Persist Security Info=False"
con.CursorLocation = adUseClient
con.Open
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -