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

📄 login.frm

📁 学生信息管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form login 
   Caption         =   "Form1"
   ClientHeight    =   9720
   ClientLeft      =   3795
   ClientTop       =   465
   ClientWidth     =   13845
   LinkTopic       =   "Form1"
   Picture         =   "Login.frx":0000
   ScaleHeight     =   9720
   ScaleWidth      =   13845
   Begin VB.CommandButton cmdreturn 
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   9840
      TabIndex        =   7
      Top             =   7920
      Width           =   1215
   End
   Begin VB.CommandButton cmdCancl 
      Caption         =   "取消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   7200
      TabIndex        =   5
      Top             =   7920
      Width           =   1335
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   4320
      TabIndex        =   4
      Top             =   7920
      Width           =   1335
   End
   Begin VB.TextBox txtpassword 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   7560
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   6840
      Width           =   2655
   End
   Begin VB.TextBox txtcode 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   7560
      TabIndex        =   1
      Top             =   5760
      Width           =   2655
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "欢迎进入学生信息查询系统"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   26.25
         Charset         =   134
         Weight          =   400
         Underline       =   -1  'True
         Italic          =   -1  'True
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000C0&
      Height          =   1335
      Left            =   2760
      TabIndex        =   6
      Top             =   1080
      Width           =   8895
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "请输入你的密码"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00808000&
      Height          =   375
      Left            =   4800
      TabIndex        =   2
      Top             =   6960
      Width           =   2535
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "请输入你的学号"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00808000&
      Height          =   375
      Left            =   4800
      TabIndex        =   0
      Top             =   5880
      Width           =   2535
   End
End
Attribute VB_Name = "login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdOK_Click()

'打开数据库
'---------验证学号密码的有效性
Dim myConnection As ADODB.Connection
Dim myRecordset As ADODB.Recordset
Set myConnection = New Connection
Set myRecordset = New Recordset
ConnectionString = " Provider=SQLOLEDB;" & "Integrated Security=SSPI;&Persist Security Info=False;" & "Initial Catalog=student;" & "Data Source=CINDY."
myConnection.Open ConnectionString
Dim txtSQL As String

If (txtcode.Text = "" Or txtpassword.Text = "") Then
Beep
MsgBox "您忘了输入学号或密码!", vbInformation
'----------------
 Else
   txtSQL = "select * from password where student_id = '" & txtcode.Text & "'"
   myRecordset.Open txtSQL, myConnection

        If myRecordset.EOF = True Then
            Beep
            MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
            txtcode.SetFocus
        Else
            If Trim(myRecordset.Fields(1)) = Trim(txtpassword.Text) Then
            o = True
            myRecordset.Close
            Unload login
            main.Show
            'UserName = Trim(id.Text)
            Else
                Beep
                MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
                txtpassword.SetFocus
                txtpassword.Text = ""
            End If
        End If
   End If
    
    miCount = miCount + 1
    If miCount = 3 Then
            Beep
            MsgBox prompt:="试图登录次数太多,再见", _
            Buttons:=vbOKOnly + vbInformation
            End
    End If
    Exit Sub

End Sub

Private Sub cmdCancl_Click()
    
    txtcode.Text = ""
    txtpassword.Text = ""
    
End Sub

Private Sub cmdreturn_Click()
    
    End
    
End Sub

⌨️ 快捷键说明

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