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

📄 changepwdfrm.frm

📁 学生选课系统 可供学生选课
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Changepwdfrm 
   Caption         =   "修改密码"
   ClientHeight    =   4890
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   4890
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox renewpwdtxt 
      Height          =   495
      Left            =   2160
      TabIndex        =   7
      Top             =   2160
      Width           =   2295
   End
   Begin VB.TextBox newpwdtxt 
      Height          =   495
      Left            =   2160
      TabIndex        =   6
      Top             =   1080
      Width           =   2295
   End
   Begin VB.TextBox oldpwdtxt 
      Height          =   495
      Left            =   2160
      TabIndex        =   5
      Top             =   240
      Width           =   2295
   End
   Begin VB.CommandButton Command2 
      Caption         =   "放弃"
      Height          =   615
      Left            =   2280
      TabIndex        =   4
      Top             =   3840
      Width           =   1695
   End
   Begin VB.CommandButton Command1 
      Caption         =   "修改"
      Height          =   615
      Left            =   240
      TabIndex        =   3
      Top             =   3840
      Width           =   1455
   End
   Begin VB.Label Label3 
      Caption         =   "重新输入"
      Height          =   735
      Left            =   120
      TabIndex        =   2
      Top             =   2040
      Width           =   1695
   End
   Begin VB.Label Label2 
      Caption         =   "新密码"
      Height          =   615
      Left            =   120
      TabIndex        =   1
      Top             =   1080
      Width           =   1575
   End
   Begin VB.Label Label1 
      Caption         =   "原来密码"
      Height          =   495
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   1455
   End
End
Attribute VB_Name = "Changepwdfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
     Dim idinfo As Recordset    '记录集
     Dim sqlstr As String       '存储sql命令字符串
     Dim changeable As Boolean  '标记是否密码可以修改
    
     If (oldpwdtxt.Text <> "" And newpwdtxt.Text <> "" And (newpwdtxt.Text = renewpwdtxt.Text)) Then
         
      
      '如果密码非空,且新密码的两次键入相一致,则标记changeable为真
     changeable = True
  Else
    MsgBox "请重新输入新密码,并确保新密码的两次输入一致", vbOKOnly, "修改密码出错"
   '清空各文本框,以便重新输入
   oldpwdtxt.Text = ""
   newpwdtxt.Text = ""
   renewpwdtxt.SetFocus
 End If
 If changeable Then
     sqlstr = "select  密码 where 学号='" & ID & "'"
     Set idinfo = courseDB.OpenRecordset(sqlstr, dbOpenDynaset) '打开记录集,以备修改
     If (idinfo.Fields("密码").Value = oldwdtxt.Text) Then '如果旧密码正确,则修改密码'更新密码
     With idinfo
    .Edit
    !密码 = newpwdtxt.Text
    .Update
    .Bookmark = .LastModified
  End With
  MsgBox "密码修改成功", vbOKOnly, "成功"
  Unload Changepwdfrm '退出窗体
 Else  '就密码错误,提示重新输入
  MsgBox "密码错误,请重试!", vbOKOnly, "修改密码出错"
  '清空各文本框,以便重新输入
  oldpwdtxt.Text = ""
    newpwdtxt.Text = ""
    renewpwdtxt.Text = ""
    oldpwdtxt.SetFocus
  End If
 idinfo.Close   '关闭记录集
End Sub
 '放弃修改
End Sub

Private Sub Command2_Click()
  Unload Changepwdfrm
End Sub

⌨️ 快捷键说明

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