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

📄 frmpsw.frm

📁 本源代码为学生图书管管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmPSW 
   Caption         =   "密码修改"
   ClientHeight    =   2580
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   3405
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2580
   ScaleWidth      =   3405
   StartUpPosition =   1  '所有者中心
   Begin VB.Frame Frame2 
      Height          =   735
      Left            =   120
      TabIndex        =   7
      Top             =   1680
      Width           =   3135
      Begin VB.CommandButton cmdReturn 
         Caption         =   "取 消"
         Height          =   375
         Left            =   1920
         TabIndex        =   9
         Top             =   240
         Width           =   855
      End
      Begin VB.CommandButton cmdConfirm 
         Caption         =   "确 定"
         Height          =   375
         Left            =   240
         TabIndex        =   8
         Top             =   240
         Width           =   855
      End
   End
   Begin VB.Frame Frame1 
      Height          =   1695
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   3135
      Begin VB.TextBox txtNewPSWAgain 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   1200
         TabIndex        =   6
         Top             =   1200
         Width           =   1695
      End
      Begin VB.TextBox txtNewPSW 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   1200
         TabIndex        =   5
         Top             =   720
         Width           =   1695
      End
      Begin VB.TextBox txtSPSW 
         Appearance      =   0  'Flat
         Height          =   375
         Left            =   1200
         TabIndex        =   4
         Top             =   240
         Width           =   1695
      End
      Begin VB.Label Label3 
         Caption         =   "密码校验:"
         Height          =   255
         Left            =   240
         TabIndex        =   3
         Top             =   1320
         Width           =   975
      End
      Begin VB.Label Label2 
         Caption         =   "新 密 码:"
         Height          =   375
         Left            =   240
         TabIndex        =   2
         Top             =   840
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "原 密 码:"
         Height          =   375
         Left            =   240
         TabIndex        =   1
         Top             =   360
         Width           =   1095
      End
   End
End
Attribute VB_Name = "frmPSW"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdConfirm_Click()
    Dim strpsw As String
    Dim rsusers As New ADODB.Recordset
    Dim strsql As String
    strsql = "select * from users where username='" & strLoginName & "'"
     If rsusers.State = adStateOpen Then rsusers.Close
    rsusers.Open strsql, conLIB, adOpenStatic, adLockOptimistic
    
    If txtSPSW.Text = "" Then
        MsgBox "请输入原密码!", vbOKOnly, "错误"
        txtSPSW.SetFocus
    Else
       If txtSPSW.Text <> rsusers!psw Then
          MsgBox "原密码输入不正确,请重输!", vbOKOnly, "错误"
          txtSPSW.SelStart = 0
          txtSPSW.SelLength = Len(txtSPSW.Text)
          txtSPSW.SetFocus
       Else
            If txtNewPSW.Text = "" Then
                MsgBox "新密码不能为空!", vbOKOnly, "错误"
                txtNewPSW.SetFocus
            Else
                If txtNewPSW.Text = txtNewPSWAgain.Text Then
                   strsql = "update users set psw='" & txtNewPSW.Text & "'where username='" & strLoginName & "'"
                   conLIB.Execute strsql
                   MsgBox "密码修改成功", vbOKOnly, "提示"
                   If rsusers.State = adStateOpen Then rsusers.Close
                   Unload Me
                Else
                    MsgBox "两次新密码输入不一致!", vbOKOnly, "错误"
                    txtNewPSW.Text = ""
                    txtNewPSWAgain.Text = ""
                    txtNewPSW.SetFocus
                End If
             End If
        End If
    End If
     If rsusers.State = adStateOpen Then rsusers.Close
End Sub

Private Sub cmdReturn_Click()
    Unload Me
    
End Sub

Private Sub Form_Load()
    txtSPSW.Text = ""
    txtSPSW.PasswordChar = "*"
    txtNewPSW.PasswordChar = "*"
    txtNewPSW.Text = ""
    txtNewPSWAgain.Text = ""
    txtNewPSWAgain.PasswordChar = "*"
    
End Sub

⌨️ 快捷键说明

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