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

📄 login_frm.frm

📁 学生选课系统。VB+Access。可进行学生信息的管理
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form login_frm 
   Caption         =   "登录窗体"
   ClientHeight    =   3540
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5250
   LinkTopic       =   "Form1"
   Picture         =   "login_frm.frx":0000
   ScaleHeight     =   3540
   ScaleWidth      =   5250
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox txtusername 
      Height          =   495
      Left            =   2280
      TabIndex        =   4
      Top             =   840
      Width           =   1215
   End
   Begin VB.TextBox txtpassword 
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   2280
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   1680
      Width           =   1215
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   3960
      Top             =   3120
      Visible         =   0   'False
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   582
      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=F:\050531123贾晨微\db1.mdb;Persist Security Info=False"
      OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\050531123贾晨微\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.CommandButton cmdexit 
      Caption         =   "退出"
      Height          =   495
      Left            =   3120
      TabIndex        =   2
      Top             =   2520
      Width           =   1095
   End
   Begin VB.CommandButton cmdok 
      Caption         =   "登录"
      Height          =   495
      Left            =   840
      TabIndex        =   1
      Top             =   2520
      Width           =   1095
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   840
      TabIndex        =   6
      Top             =   960
      Width           =   840
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "密码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   840
      TabIndex        =   5
      Top             =   1800
      Width           =   630
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "欢迎登录学生选课系统"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   18
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   720
      TabIndex        =   0
      Top             =   240
      Width           =   3600
   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
Public OK As Boolean
Dim miCount As Integer
Dim con As ADODB.Connection

Private Sub Form_Load()
'创建连接
    Set con = New ADODB.Connection
    con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\050531123贾晨微\db1.mdb;Persist Security Info=False"
    con.CursorLocation = adUseClient
    con.Open
    OK = False
    miCount = 0
End Sub
Private Sub cmdexit_Click()
'退出
    OK = False
    Me.Hide
End Sub
Private Sub cmdok_Click()
'登录
    Dim rs As New ADODB.Recordset
    Dim query As String
    query = "select * from pwd where 用户名 = '" & Trim(txtusername.Text) & "'"
    rs.Open query, con, adOpenForwardOnly, adLockReadOnly
    If Trim(rs.Fields("用户名")) = Trim(txtusername.Text) Then
    '检验用户名
       username = txtusername.Text
       If Trim(rs.Fields("密码")) = Trim(txtpassword.Text) Then
       '检验密码
           If Trim(rs.Fields("权限")) = "学生" Then
           '检验权限
                Me.Hide
                power = "学生"
                mdiform1.Show
                mdiform1.user.Enabled = True
                mdiform1.zhuxiao.Enabled = True
                mdiform1.student.Enabled = True
                mdiform1.teacher.Enabled = False
                mdiform1.course.Enabled = True
                mdiform1.t_choice.Enabled = False
                mdiform1.s_choice.Enabled = True
                mdiform1.s_c_q.Enabled = True
                mdiform1.t_c_q.Enabled = False
                mdiform1.dayin.Enabled = True
            Else
                Me.Hide
                power = "教师"
                mdiform1.Show
                mdiform1.user.Enabled = True
                mdiform1.zhuxiao.Enabled = True
                mdiform1.student.Enabled = False
                mdiform1.teacher.Enabled = True
                mdiform1.course.Enabled = True
                mdiform1.t_choice.Enabled = True
                mdiform1.s_choice.Enabled = False
                mdiform1.s_c_q.Enabled = False
                mdiform1.t_c_q.Enabled = True
                mdiform1.dayin.Enabled = True
            End If
        Else
            MsgBox "密码错误!"
            txtpassword.Text = ""
            txtpassword.SetFocus
        End If
    Else
        MsgBox "该用户名不存在!"
    End If
    rs.Close
    '判断输入错误密码的次数,若达到3次,则自动退出登录窗体
    miCount = miCount + 1
    If miCount = 3 Then
        Me.Hide
    End If
    Exit Sub
End Sub

⌨️ 快捷键说明

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