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

📄 fmpwd.frm

📁 <Visual Basic 数据库开发实例精粹(第二版)>一书首先介绍了Visual Basic(简称VB)开发的技巧和重点技术
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FMPwd 
   Caption         =   "密码设置"
   ClientHeight    =   3375
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   3375
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "主界面"
      Height          =   495
      Left            =   3360
      TabIndex        =   8
      Top             =   2760
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   495
      Left            =   1800
      TabIndex        =   7
      Top             =   2760
      Width           =   1095
   End
   Begin VB.Frame Frame1 
      Caption         =   "修改密码"
      Height          =   2415
      Left            =   0
      TabIndex        =   0
      Top             =   120
      Width           =   4695
      Begin VB.TextBox TextCodeN 
         Height          =   375
         IMEMode         =   3  'DISABLE
         Left            =   1920
         PasswordChar    =   "*"
         TabIndex        =   6
         Top             =   1680
         Width           =   1695
      End
      Begin VB.TextBox TextCode 
         Height          =   375
         IMEMode         =   3  'DISABLE
         Left            =   1920
         PasswordChar    =   "*"
         TabIndex        =   5
         Top             =   1020
         Width           =   1695
      End
      Begin VB.TextBox TextUserID 
         Height          =   375
         Left            =   1920
         TabIndex        =   4
         Top             =   360
         Width           =   1695
      End
      Begin VB.Label Label3 
         Caption         =   "新密码:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   720
         TabIndex        =   3
         Top             =   1800
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   "原密码:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   720
         TabIndex        =   2
         Top             =   1140
         Width           =   1095
      End
      Begin VB.Label Label1 
         Caption         =   "用户名:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   720
         TabIndex        =   1
         Top             =   480
         Width           =   1095
      End
   End
End
Attribute VB_Name = "FMPwd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()
  Dim ModCode As New ADODB.Recordset
  Dim Str As String
  Dim sUserID As String
  Dim sCode As String
  Dim sCodeN As String

  If Trim(Me.TextUserID.Text) = "" Then
    MsgBox "请输入用户ID!"
    Exit Sub
  End If
    
  sUserID = Trim(Me.TextUserID.Text)
    
  If Trim(Me.TextCode.Text) = "" Then
    MsgBox "请输入原密码!"
    Exit Sub
  End If
    
  sCode = Trim(Me.TextCode.Text)
    
  If Trim(Me.TextCodeN.Text) = "" Then
    MsgBox "请输入新密码!"
    Exit Sub
  End If
    
  If Trim(Me.TextCodeN.Text) = Trim(Me.TextCode.Text) Then
    MsgBox "输入的原密码和新密码一致!"
    Exit Sub
  End If
    
  sCodeN = Trim(Me.TextCodeN.Text)
    
  Str = "select * from UserInfo where UserID='" & sUserID & "'"
  ModCode.Open Str, g_DBConn, adOpenStatic, adLockOptimistic
  ModCode.MoveFirst

  If Trim(Me.TextCode.Text) = ModCode.Fields("UserPwd").Value Then
    ModCode.Fields("UserPwd").Value = Trim(Me.TextCodeN.Text)
  Else
    MsgBox "原密码错误,修改失败!"
    Exit Sub
        
  End If

  ModCode.Update
  ModCode.Close
  MsgBox "修改成功!"
    
  Me.TextUserID.Text = ""
  Me.TextCode.Text = ""
  Me.TextCodeN.Text = ""
    
End Sub

Private Sub Command2_Click()
  Unload Me
    
End Sub

Private Sub Form_Load()
  Me.Top = (Screen.Height - Me.Height) / 2    '垂直方向居中
  Me.Left = (Screen.Width - Me.Height) / 2    '水平方向居中
End Sub

⌨️ 快捷键说明

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