⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.frm

📁 学籍管理系统,管理员登陆可以删除修改学生记录
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmLogin 
   BackColor       =   &H00C0C000&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "请登录"
   ClientHeight    =   4515
   ClientLeft      =   2835
   ClientTop       =   3480
   ClientWidth     =   6060
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2667.61
   ScaleMode       =   0  'User
   ScaleWidth      =   5690.01
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame fraUser 
      BackColor       =   &H00C0C000&
      Caption         =   "选择身份"
      Height          =   855
      Left            =   960
      TabIndex        =   5
      Top             =   480
      Width           =   3975
      Begin VB.OptionButton optUserType 
         BackColor       =   &H00C0C000&
         Caption         =   "学生"
         Height          =   375
         Index           =   1
         Left            =   2280
         TabIndex        =   9
         Top             =   240
         Width           =   1095
      End
      Begin VB.OptionButton optUserType 
         BackColor       =   &H00C0C000&
         Caption         =   "管理人员"
         Height          =   375
         Index           =   0
         Left            =   360
         TabIndex        =   8
         Top             =   240
         Width           =   1455
      End
   End
   Begin VB.Frame frmLogin 
      BackColor       =   &H00C0C000&
      Caption         =   "登录"
      Height          =   1695
      Left            =   960
      TabIndex        =   2
      Top             =   1680
      Width           =   3975
      Begin VB.CommandButton cmdCancel 
         BackColor       =   &H00C0C000&
         Cancel          =   -1  'True
         Caption         =   "取消"
         Height          =   390
         Left            =   2880
         MaskColor       =   &H00C0C000&
         Style           =   1  'Graphical
         TabIndex        =   7
         Top             =   840
         Width           =   900
      End
      Begin VB.CommandButton cmdOK 
         BackColor       =   &H00C0C000&
         Caption         =   "确定"
         Default         =   -1  'True
         Height          =   390
         Left            =   2880
         MaskColor       =   &H00C0C000&
         Style           =   1  'Graphical
         TabIndex        =   6
         Top             =   360
         Width           =   900
      End
      Begin VB.TextBox txtPwd 
         Height          =   345
         IMEMode         =   3  'DISABLE
         Left            =   1080
         PasswordChar    =   "*"
         TabIndex        =   1
         Top             =   885
         Width           =   1485
      End
      Begin VB.TextBox txtUser 
         Height          =   345
         Left            =   1080
         TabIndex        =   0
         Top             =   360
         Width           =   1485
      End
      Begin VB.Label lblLabels 
         AutoSize        =   -1  'True
         BackColor       =   &H00C0C000&
         Caption         =   "用户名:"
         Height          =   195
         Index           =   0
         Left            =   360
         TabIndex        =   4
         Top             =   390
         Width           =   720
      End
      Begin VB.Label lblLabels 
         AutoSize        =   -1  'True
         BackColor       =   &H00C0C000&
         Caption         =   "口令:"
         Height          =   195
         Index           =   1
         Left            =   540
         TabIndex        =   3
         Top             =   915
         Width           =   540
      End
   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 mnUserType As Integer

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
    Dim user As String, pwd As String
    user = txtUser
    pwd = txtPwd
    Dim r As New ADODB.Recordset
    Set r = DataEnv.rssqlSeek
    Dim strSQL As String
    Select Case mnUserType
        Case 0:
            strSQL = "select * from admin where name='" & user & "' and pwd='" & pwd & "'"
        Case 1:
            strSQL = "select * from student where name='" & user & "' and serial='" & pwd & "'"
    End Select
    
    On Error Resume Next
    If r.State = adStateOpen Then r.Close
    r.Open strSQL
       
    Static Conut As Integer
    
    If r.EOF Then
      MsgBox "对不起,无此用户或者密码不正确!请重新输入!!", vbCritical, "错误"
      txtUser.SetFocus
      txtUser.SelStart = 0
      txtUser.SelLength = Len(txtUser)
      Conut = Conut + 1
      If Conut >= 3 Then
         MsgBox "您无权操作本系统!再见!", vbCritical, "无权限"
         Unload Me
      End If
    Else
      Load MDIMain
      With MDIMain
        .mnUserType = mnUserType
        .msUserName = pwd
        .Show
      End With
      If MDIMain.mnUserType = 0 Then
      MDIMain.addoper.Enabled = True
      Else
      MDIMain.addoper.Enabled = False
      End If
      Unload Me
    End If
End Sub

Private Sub Form_Load()
    optUserType(0).Value = True
End Sub

Private Sub optUserType_Click(Index As Integer)
    mnUserType = Index
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -