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

📄 frmchangepwd.frm

📁 用VB编写的简单的学生成绩管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmChangePwd 
   Caption         =   "修改密码"
   ClientHeight    =   3195
   ClientLeft      =   3660
   ClientTop       =   2985
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3195
   ScaleWidth      =   4680
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Height          =   375
      Left            =   600
      TabIndex        =   7
      Top             =   2640
      Width           =   1335
   End
   Begin VB.TextBox txtOld 
      BeginProperty Font 
         Name            =   "微软雅黑"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   1680
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   240
      Width           =   2295
   End
   Begin VB.TextBox txtRePwd 
      BeginProperty Font 
         Name            =   "微软雅黑"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   1680
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   1920
      Width           =   2295
   End
   Begin VB.TextBox txtPwd 
      BeginProperty Font 
         Name            =   "微软雅黑"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      IMEMode         =   3  'DISABLE
      Left            =   1680
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   1080
      Width           =   2295
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消"
      Height          =   375
      Left            =   2640
      TabIndex        =   0
      Top             =   2640
      Width           =   1335
   End
   Begin VB.Label Label3 
      Caption         =   "新密码确认:"
      BeginProperty Font 
         Name            =   "微软雅黑"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   120
      TabIndex        =   6
      Top             =   1920
      Width           =   1455
   End
   Begin VB.Label Label2 
      Caption         =   "请输入新密码:"
      BeginProperty Font 
         Name            =   "微软雅黑"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   120
      TabIndex        =   4
      Top             =   1080
      Width           =   1575
   End
   Begin VB.Label Label1 
      Caption         =   "请输入旧密码:"
      BeginProperty Font 
         Name            =   "微软雅黑"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   120
      TabIndex        =   2
      Top             =   360
      Width           =   1575
   End
End
Attribute VB_Name = "frmChangePwd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public LoginSucceeded As Boolean
Dim objCn As Connection
Dim objSysLogin As Recordset
Private Sub cmdCancel_Click()
    Unload Me
End Sub
Private Sub cmdOK_Click()
    If txtOld = Trim(objSysLogin.Fields("pass")) Then
        If txtRePwd.Text = txtPwd.Text Then
            '写入数据库
            objSysLogin.Fields("pass") = Trim(txtRePwd)
            objSysLogin.Update '修改密码后一定要更新,否则无用。
            MsgBox "密码修改成功,请记住您的新密码", vbInformation, "修改密码"
            Unload Me
        Else
            MsgBox "确认输入密码与新密码不相同,请重新输入。", vbExclamation, "修改密码"
            txtPwd.Text = "": txtRePwd.Text = "": txtPwd.SetFocus
        End If
    Else
        MsgBox "旧密码输入错误,请重试。", vbExclamation, "修改密码"
        txtOld.SetFocus
        txtOld.Text = ""
    End If
End Sub
Private Sub Form_Load()
    Set objCn = New Connection
    With objCn
        .Provider = "SQLOLEDB"
        .ConnectionString = "User ID=db4;PWD=lsc;Data Source=(local);" & _
        "Initial Catalog=成绩管理"
        .Open
    End With
    Set objSysLogin = New Recordset
    With objSysLogin
        Set .ActiveConnection = objCn
        .CursorLocation = adUseClient
        .CursorType = adOpenStatic
        .LockType = adLockOptimistic
        .Open "select * from Systemlogin"
    End With
End Sub

⌨️ 快捷键说明

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