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

📄 frmchangpwd.frm

📁 < 飞鸿商品>>零售是基于VB+SQL2000开的商品零售管理系统. 开发的很好.可以一看
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmChangPWD 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "密码更改"
   ClientHeight    =   3165
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   4440
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   10.5
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmChangPWD.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3165
   ScaleWidth      =   4440
   Begin Manage.xpcmdbutton cmdCancel 
      Height          =   405
      Left            =   2520
      TabIndex        =   9
      Top             =   2580
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   714
      Caption         =   "取  消"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin Manage.xpcmdbutton cmdEnter 
      Height          =   405
      Left            =   690
      TabIndex        =   8
      Top             =   2580
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   714
      Caption         =   "确  定"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.TextBox txtEnter 
      Height          =   315
      IMEMode         =   3  'DISABLE
      Left            =   1110
      PasswordChar    =   "*"
      TabIndex        =   7
      Top             =   1860
      Width           =   2475
   End
   Begin VB.TextBox txtNew 
      Height          =   315
      IMEMode         =   3  'DISABLE
      Left            =   1110
      PasswordChar    =   "*"
      TabIndex        =   6
      Top             =   1365
      Width           =   2475
   End
   Begin VB.TextBox txtOld 
      Height          =   315
      IMEMode         =   3  'DISABLE
      Left            =   1110
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   870
      Width           =   2475
   End
   Begin VB.Line Line2 
      BorderColor     =   &H00C0C0C0&
      X1              =   30
      X2              =   4440
      Y1              =   2340
      Y2              =   2340
   End
   Begin VB.Line Line1 
      BorderColor     =   &H00FFFFFF&
      X1              =   30
      X2              =   4440
      Y1              =   720
      Y2              =   720
   End
   Begin VB.Label lblUser 
      BackColor       =   &H00FFFFFF&
      BorderStyle     =   1  'Fixed Single
      Height          =   315
      Left            =   1110
      TabIndex        =   4
      Top             =   270
      Width           =   2475
   End
   Begin VB.Label Label4 
      Caption         =   "确  认:"
      Height          =   210
      Left            =   300
      TabIndex        =   3
      Top             =   1890
      Width           =   840
   End
   Begin VB.Label Label3 
      Caption         =   "新密码:"
      Height          =   210
      Left            =   300
      TabIndex        =   2
      Top             =   1395
      Width           =   840
   End
   Begin VB.Label Label2 
      Caption         =   "原密码:"
      Height          =   210
      Left            =   300
      TabIndex        =   1
      Top             =   915
      Width           =   840
   End
   Begin VB.Label Label1 
      Caption         =   "用  户:"
      Height          =   210
      Left            =   330
      TabIndex        =   0
      Top             =   300
      Width           =   840
   End
End
Attribute VB_Name = "frmChangPWD"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdCancel_Click()
  Unload Me
End Sub

Private Sub cmdEnter_Click()
Dim Rst As ADODB.Recordset
Dim Cmd As ADODB.Command
Dim SQL As String

If txtOld.Text = "" Or txtNew.Text = "" Or txtEnter.Text = "" Then
    MsgBox "确认密码时出错!请重新输入密码!", 16
    txtOld.Text = ""
    txtNew.Text = ""
    txtEnter.Text = ""
    txtOld.SetFocus
    Exit Sub
End If
If txtNew.Text <> txtEnter.Text Then
  MsgBox "新密码确认不相铺!请重新输入!", 16
  txtOld.Text = ""
  txtNew.Text = ""
  txtEnter.Text = ""
  txtOld.SetFocus
  Exit Sub
End If

Set Rst = New ADODB.Recordset
Rst.CursorLocation = adUseClient
SQL = "select * from [user] where username='" & UserName & "' and password='" & txtOld.Text & "'"
Rst.Open SQL, Conn, adOpenDynamic, adLockReadOnly, adCmdText
If Rst.EOF Then
  MsgBox "原密码确认出错,密码核实不正确。密码更改不成功!", 16
  txtOld.Text = ""
  txtNew.Text = ""
  txtEnter.Text = ""
  txtOld.SetFocus
  Exit Sub
End If
Set Rst = Nothing

Set Cmd = New ADODB.Command
Cmd.ActiveConnection = Conn
SQL = "update [user] set password='" & txtNew.Text & "' where username='" & UserName & "'"
Cmd.CommandText = SQL
Cmd.CommandType = adCmdText
Cmd.Execute

Set Cmd = Nothing

MsgBox "密码更改成功!", 64

Unload Me
End Sub

Private Sub Form_Load()
  lblUser.Caption = UserName
End Sub

Private Sub Form_Unload(Cancel As Integer)
  Set frmChangPWD = Nothing
End Sub

⌨️ 快捷键说明

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