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

📄 form2.frm

📁 学生成绩管理
💻 FRM
字号:
VERSION 5.00
Begin VB.Form usemmchange 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "密码修改"
   ClientHeight    =   4440
   ClientLeft      =   45
   ClientTop       =   450
   ClientWidth     =   4500
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "Form2.frx":0000
   ScaleHeight     =   4440
   ScaleWidth      =   4500
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command2 
      Caption         =   "关闭"
      Height          =   495
      Left            =   2520
      TabIndex        =   6
      Top             =   3600
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   495
      Left            =   720
      TabIndex        =   5
      Top             =   3600
      Width           =   1335
   End
   Begin VB.TextBox txtUserId 
      Height          =   375
      Left            =   2160
      MaxLength       =   10
      TabIndex        =   0
      Top             =   360
      Width           =   1695
   End
   Begin VB.TextBox txtUserName 
      BackColor       =   &H00FFFFFF&
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   2160
      MaxLength       =   20
      TabIndex        =   1
      TabStop         =   0   'False
      Top             =   930
      Width           =   1695
   End
   Begin VB.TextBox txtOldPass 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   2160
      MaxLength       =   10
      PasswordChar    =   "*"
      TabIndex        =   2
      Top             =   1440
      Width           =   1695
   End
   Begin VB.TextBox txtNewPass 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   2160
      MaxLength       =   10
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   2010
      Width           =   1695
   End
   Begin VB.TextBox txtNewPass1 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   2160
      MaxLength       =   10
      PasswordChar    =   "*"
      TabIndex        =   4
      Top             =   2670
      Width           =   1695
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户编号(&U):"
      Height          =   180
      Left            =   720
      TabIndex        =   11
      Top             =   480
      Width           =   1170
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "用户名:"
      Height          =   180
      Left            =   720
      TabIndex        =   10
      Top             =   1020
      Width           =   720
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "旧密码(&P):"
      Height          =   180
      Left            =   720
      TabIndex        =   9
      Top             =   1560
      Width           =   990
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "新密码(&N):"
      Height          =   180
      Left            =   720
      TabIndex        =   8
      Top             =   2100
      Width           =   990
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "确认密码(&C)"
      Height          =   180
      Left            =   720
      TabIndex        =   7
      Top             =   2760
      Width           =   990
   End
End
Attribute VB_Name = "usemmchange"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public rs As New ADODB.Recordset
Public rs1 As New ADODB.Recordset
Public rs2 As New ADODB.Recordset
Private Sub Command1_Click()
Dim sql As String
Dim sq As String
Dim sq1 As String
con.Open
sql = "select yhbh from yhb where yhbh='" & txtUserId.Text & "'"
Set rs = con.Execute(sql)
sq = "select yhmc from yhb where yhbh='" & txtUserId.Text & "' and yhmc='" & txtUserName.Text & "'"
Set rs1 = con.Execute(sq)
sq1 = "select yhmm from yhb where yhbh='" & txtUserId.Text & "' and yhmc='" & txtUserName.Text & "' and yhmm='" & txtOldPass.Text & "'"
Set rs2 = con.Execute(sq1)
If txtUserId.Text = "" Then
   MsgBox "请输入用户编号!", vbOKOnly + vbInformation, "修改密码"
   txtUserId.SetFocus
   con.Close
   Exit Sub
Else
  If rs.BOF Or rs.EOF Then
     MsgBox "该用户编号不存在,请输入用户编号!", vbOKOnly + vbInformation, "修改密码"
     txtUserId.Text = ""
     txtUserId.SetFocus
  Else
    If txtUserName.Text = "" Then
       MsgBox "请输入用户名!", vbOKOnly + vbInformation, "修改密码"
       txtUserId.SetFocus
       con.Close
    Exit Sub
    Else
      If rs1.BOF Or rs1.EOF Then
         MsgBox "用户名错误,请重新输入!", vbOKOnly + vbInformation, "修改密码"
         txtUserName.Text = ""
         txtUserName.SetFocus
      Else
        If txtOldPass.Text = "" Then
           MsgBox "请输入旧密码!", vbOKOnly + vbInformation, "修改密码"
           txtOldPass.SetFocus
           con.Close
        Exit Sub
        Else
          If rs2.BOF Or rs2.EOF Then
             MsgBox "旧密码不正确!", vbOKOnly + vbInformation, "修改密码"
             txtOldPass.Text = ""
             txtOldPass.SetFocus
          Else
            If txtNewPass.Text = "" Then
            MsgBox "请输入新密码!", vbOKOnly + vbInformation, "修改密码"
            txtNewPass.SetFocus
            con.Close
            Exit Sub
            Else
              If txtNewPass1.Text = "" Then
              MsgBox "请输入新密码!", vbOKOnly + vbInformation, "修改密码"
              txtNewPass1.SetFocus
              con.Close
              Exit Sub
              Else
                If txtNewPass.Text <> txtNewPass1.Text Then
                   MsgBox "两次输入的密码不一致,请重新输入!", vbOKOnly + vbInformation, "修改密码"
                   txtNewPass.Text = ""
                   txtNewPass1.Text = ""
                   txtNewPass.SetFocus
                   con.Close
                   Exit Sub
                Else
                     sql = "update yhb set yhmm='" & txtNewPass.Text & "' where yhbh='" & txtUserId.Text & "'"
                     con.Execute (sql)
                     MsgBox "密码修改成功!", vbOKOnly + vbInformation, "修改密码"
                     Unload Me
                End If
              End If
            End If
          End If
        End If
      End If
    End If
  End If
End If
con.Close
End Sub

Private Sub Command2_Click()
Unload Me
frmmain.Show
End Sub

Private Sub Form_Load()
Call st1
End Sub

⌨️ 快捷键说明

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