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

📄 renpwfrm.frm

📁 一个票务管理软件
💻 FRM
字号:
VERSION 5.00
Begin VB.Form renpwfrm 
   Caption         =   "修改密码"
   ClientHeight    =   3360
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6615
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   3360
   ScaleWidth      =   6615
   Begin VB.TextBox txtusername 
      BackColor       =   &H80000003&
      Enabled         =   0   'False
      Height          =   375
      Left            =   1440
      TabIndex        =   11
      Top             =   1080
      Width           =   1215
   End
   Begin VB.TextBox txtgonghao 
      Height          =   375
      Left            =   1440
      TabIndex        =   9
      Top             =   360
      Width           =   1215
   End
   Begin VB.CommandButton cmdexit 
      Caption         =   "退出"
      Height          =   375
      Left            =   4200
      TabIndex        =   7
      Top             =   2640
      Width           =   1215
   End
   Begin VB.CommandButton cmdok 
      Caption         =   "确定"
      Height          =   375
      Left            =   1080
      TabIndex        =   6
      Top             =   2640
      Width           =   1215
   End
   Begin VB.TextBox txtpw 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   4560
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   1800
      Width           =   1455
   End
   Begin VB.TextBox txtnewpw 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   4560
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   1080
      Width           =   1455
   End
   Begin VB.TextBox txtoldpw 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   4560
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   360
      Width           =   1455
   End
   Begin VB.Label Label2 
      Caption         =   "用户姓名:"
      Height          =   375
      Left            =   360
      TabIndex        =   10
      Top             =   1200
      Width           =   975
   End
   Begin VB.Label Label1 
      Caption         =   "用户工号:"
      Height          =   255
      Left            =   360
      TabIndex        =   8
      Top             =   480
      Width           =   975
   End
   Begin VB.Label Label6 
      Caption         =   "重新确认:"
      Height          =   255
      Left            =   3480
      TabIndex        =   4
      Top             =   1920
      Width           =   975
   End
   Begin VB.Label Label5 
      Caption         =   "新密码:"
      Height          =   255
      Left            =   3600
      TabIndex        =   2
      Top             =   1200
      Width           =   735
   End
   Begin VB.Label Label4 
      Caption         =   "原来密码:"
      Height          =   255
      Left            =   3480
      TabIndex        =   0
      Top             =   480
      Width           =   975
   End
End
Attribute VB_Name = "renpwfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rstjinbin As New ADODB.Recordset
Dim cnnjinbin As New ADODB.Connection
Dim change As Boolean
Dim strsql As String

Private Sub cmdexit_Click()
renpwfrm.Hide
Unload Me
End Sub

Private Sub cmdok_Click()

If (txtoldpw.Text <> "" And txtnewpw.Text <> "" And (txtnewpw.Text = txtpw.Text)) Then
change = True
Else
MsgBox "请重新输入新密码,并确保新密码的两次输入一致", vbOKOnly, "修改密码出错"
txtoldpw.Text = ""
txtnewpw.Text = ""
txtpw.Text = ""
txtoldpw.SetFocus
End If

If change Then

With cnnjinbin
    If .State = adStateOpen Then
       .Close
    End If
       .Provider = "microsoft.jet.oledb.4.0"
       .ConnectionString = App.Path & "\jinbin.mdb"
       .Open
End With

strsql = "select userpassword from userinfo where userid='" & Trim(txtgonghao.Text) & "'"

With rstjinbin
   If .State = adStateOpen Then
      .Close
   End If
      .LockType = adLockOptimistic
      .CursorLocation = adUseClient
      .CursorType = adOpenStatic
      .ActiveConnection = cnnjinbin
      .Open strsql, Options:=adCmdText
    
   If txtoldpw.Text = Trim(.Fields!userpassword.Value) Then
    
   Do Until .EOF
      .Fields!userpassword.Value = txtnewpw.Text
      .Update
      .MoveNext
      Loop
      MsgBox "密码修改成功!", vbOKOnly, "修改成功"
      txtoldpw.Text = ""
      txtnewpw.Text = ""
      txtpw.Text = ""
      txtoldpw.SetFocus
      Else
      MsgBox "密码错误,请重试!", vbOKOnly, "修改密码出错"
      txtoldpw.Text = ""
      txtnewpw.Text = ""
      txtpw.Text = ""
      txtoldpw.SetFocus
   End If
      .Close
   Set rstttransit = Nothing

End With
End If
End Sub

Private Sub Form_Load()
With renpwfrm
.Height = 3600
.ScaleHeight = 3600
.ScaleWidth = 7200
.Width = 7200
End With
End Sub

Private Sub txtgonghao_LostFocus()
If Len(Trim(txtgonghao.Text)) <> 0 Then
With cnnjinbin
If .State = adStateOpen Then
   .Close
End If
   .Provider = "microsoft.jet.oledb.4.0"
   .ConnectionString = App.Path & "\jinbin.mdb"
   .Open
End With

With rstjinbin
If .State = adStateOpen Then
   .Close
End If
   .LockType = adLockReadOnly
   .CursorLocation = adUseClient
   .CursorType = adOpenDynamic
   .ActiveConnection = cnnjinbin
   .Source = "select userid,username,userpassword,userjibie from userinfo where userid='" & Trim(txtgonghao.Text) & "'"
   .Open
If .RecordCount <> 0 Then
Do Until .EOF
txtusername.Text = Trim(.Fields!UserName.Value)
.MoveNext
Loop
Else
MsgBox "输入的工号非法,请重新输入", vbOKOnly
txtgonghao.Text = ""
txtgonghao.SetFocus
Exit Sub
End If
End With
End If
End Sub

⌨️ 快捷键说明

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