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

📄 frmmodifypsw.frm

📁 一个功能强大、程序条理分明的学生学籍管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{C2A990D9-DFD1-4B7C-A432-A1DD219DC55F}#1.0#0"; "UserCtrProj.ocx"
Begin VB.Form frmModifyPsw 
   Caption         =   "修改密码"
   ClientHeight    =   2790
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4170
   LinkTopic       =   "Form2"
   ScaleHeight     =   2790
   ScaleWidth      =   4170
   StartUpPosition =   3  'Windows Default
   Begin UserCtrProj.UsrCtrText txtConfirmPsw 
      Height          =   375
      Left            =   1800
      TabIndex        =   3
      Top             =   1440
      Width           =   1695
      _ExtentX        =   2990
      _ExtentY        =   661
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      PasswordChar    =   "*"
      FontSize        =   8.25
      FontName        =   "MS Sans Serif"
   End
   Begin UserCtrProj.UsrCtrText txtNewPsw 
      Height          =   375
      Left            =   1800
      TabIndex        =   2
      Top             =   840
      Width           =   1695
      _ExtentX        =   2990
      _ExtentY        =   661
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      PasswordChar    =   "*"
      FontSize        =   8.25
      FontName        =   "MS Sans Serif"
   End
   Begin UserCtrProj.UsrCtrText txtOldPsw 
      Height          =   375
      Left            =   1800
      TabIndex        =   1
      Top             =   240
      Width           =   1695
      _ExtentX        =   2990
      _ExtentY        =   661
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      PasswordChar    =   "*"
      FontSize        =   8.25
      FontName        =   "MS Sans Serif"
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消"
      Height          =   375
      Left            =   2640
      TabIndex        =   5
      Top             =   2280
      Width           =   1095
   End
   Begin VB.CommandButton cmdOk 
      Caption         =   "确定"
      Height          =   375
      Left            =   600
      Picture         =   "frmModifyPsw.frx":0000
      TabIndex        =   4
      Top             =   2280
      Width           =   1215
   End
   Begin VB.Label lblConfirmPsw 
      Caption         =   "确定新密码:"
      Height          =   255
      Left            =   240
      TabIndex        =   7
      Top             =   1440
      Width           =   1215
   End
   Begin VB.Label lblNewPsw 
      Caption         =   "输入新密码:"
      Height          =   255
      Left            =   240
      TabIndex        =   6
      Top             =   840
      Width           =   1215
   End
   Begin VB.Label lblOldPsw 
      Caption         =   "输入旧密码:"
      Height          =   255
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   1215
   End
End
Attribute VB_Name = "frmModifyPsw"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rsPsw As ADODB.Recordset

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOk_Click()
    '定义用来链接数据库获取记录集的SQL语句
    Dim strSql As String
    
    Set rsPsw = New Recordset
    '用到了全局变量dbUser和usrPsw,记录当前登录的用户名,这样
    '返回的记录集将只有一条记录
    strSql = "select * from uUsers where 用户名=" & "'" & dbUser & "'" & _
        " and 用户密码=" & "'" & usrPsw & "'"
    
    '用当前登录的用户名和密码作为查询条件来生成记录集
    Set rsPsw = GetRecordSet(strSql)
    
    '如果返回的rsPsw记录集为空,则属于发生了比较严重的错误,需要重新登录
    If rsPsw.EOF And rsPsw.BOF Then
        MsgBox "当前系统用户错误,请重新登录!"
        Exit Sub
    End If
    
    '如果当前输入旧密码正确,那么就开始执行密码修改的工作,否则将提示出错
    If usrPsw = Trim$(txtOldPsw.Text) Then
        rsPsw.MoveLast
        rsPsw.MoveFirst

        '对两次输入的密码进行比较,如果一致,那么密码修改成功
        If Trim$(txtNewPsw.Text) = Trim$(txtConfirmPsw.Text) Then
            rsPsw("用户密码") = Trim$(txtNewPsw.Text)
            rsPsw.Update
            Unload frmModifyPsw
        Else
            MsgBox "前后输入的新密码不一致!"
            txtNewPsw.SetFocus
            txtConfirmPsw.Text = vbNullString
            Exit Sub
        End If
    Else
        MsgBox "原始密码输入错误!"
        txtOldPsw.SetFocus
        Exit Sub
    End If
End Sub

Private Sub Form_Load()
    Move (Screen.Width - Me.Width) / 2, _
        (Screen.Height - Me.Height) / 2
End Sub

⌨️ 快捷键说明

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