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

📄 frmchangepassword.frm

📁 这个是VB环境开发的,我也是转载的把原来的Access数据库改成了SQl Server数据库.希望大家可以借鉴
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmChangePassword 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "操作员修改密码"
   ClientHeight    =   2580
   ClientLeft      =   2760
   ClientTop       =   3756
   ClientWidth     =   5400
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2580
   ScaleWidth      =   5400
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox txtNewPassword2 
      Appearance      =   0  'Flat
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   1920
      PasswordChar    =   "*"
      TabIndex        =   4
      Top             =   1440
      Width           =   1215
   End
   Begin VB.TextBox txtNewPassword1 
      Appearance      =   0  'Flat
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   1920
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   915
      Width           =   1215
   End
   Begin VB.TextBox txtOldPassword 
      Appearance      =   0  'Flat
      Height          =   270
      IMEMode         =   3  'DISABLE
      Left            =   1920
      PasswordChar    =   "*"
      TabIndex        =   2
      Top             =   360
      Width           =   1215
   End
   Begin VB.CommandButton CancelButton 
      Appearance      =   0  'Flat
      Caption         =   "取消"
      Height          =   375
      Left            =   3840
      TabIndex        =   1
      Top             =   1080
      Width           =   1215
   End
   Begin VB.CommandButton OKButton 
      Appearance      =   0  'Flat
      Caption         =   "确定"
      Height          =   375
      Left            =   3840
      TabIndex        =   0
      Top             =   360
      Width           =   1215
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "校验新密码:"
      Height          =   180
      Left            =   720
      TabIndex        =   7
      Top             =   1440
      Width           =   1080
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "新密码:"
      Height          =   180
      Left            =   720
      TabIndex        =   6
      Top             =   915
      Width           =   720
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "原密码:"
      Height          =   180
      Left            =   720
      TabIndex        =   5
      Top             =   405
      Width           =   720
   End
End
Attribute VB_Name = "frmChangePassword"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
Dim cnn As New ADODB.Connection



Private Sub CancelButton_Click()
  Unload Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
If cnn.State = 1 Then
cnn.Close
End If
End Sub

Private Sub Image1_Click()

End Sub

Private Sub OKButton_Click()
 On Error GoTo err
  If Not (Trim(txtNewPassword1) <> "" And Trim(txtNewPassword2) <> "") Then
    MsgBox "请先输入密码。"
    Exit Sub
  End If
  '判断前后两次输入的新密码是否一致
  If Len(txtNewPassword1) = Len(txtNewPassword2) And txtNewPassword1 = txtNewPassword2 Then
   If txtOldPassword = Usrpass Then
       

   Dim db As Connection
 
   Set db = New Connection
   Dim cmd As New ADODB.Command
   db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & _
                          "\data\jxcdb.mdb;Persist Security Info=False"
   cmd.ActiveConnection = db
   cmd.CommandText = "update usertable set userpwd='" & Trim(txtNewPassword1) & "' where username='" & UsrName & " '"
   cmd.Execute
   MsgBox " 密码更改成功!"
   Usrpass = Trim(txtNewPassword1)
   Unload Me

    Else
      MsgBox "您输入的原密码不正确,请重试", , "出错信息提示"
    End If
  Else
    MsgBox "您输入的新密码前后不一致,请重试", , "出错信息提示"
  End If
  Exit Sub
err:
MsgBox err.Description
End Sub



⌨️ 快捷键说明

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