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

📄 更改密码.frm

📁 医院工资管理系统 本实例以一个市级医院常用的工资管理系统为例
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form8 
   Caption         =   "更改密码"
   ClientHeight    =   3480
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4860
   Icon            =   "更改密码.frx":0000
   LinkTopic       =   "Form8"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3480
   ScaleWidth      =   4860
   StartUpPosition =   2  '屏幕中心
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   2280
      TabIndex        =   7
      Top             =   480
      Width           =   1215
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   2280
      TabIndex        =   6
      Top             =   1440
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   375
      Left            =   2520
      TabIndex        =   2
      Top             =   2520
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确认修改"
      Height          =   375
      Left            =   1200
      TabIndex        =   1
      Top             =   2520
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   2280
      TabIndex        =   0
      Top             =   960
      Width           =   1215
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "新密码:"
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C000C0&
      Height          =   240
      Left            =   1320
      TabIndex        =   5
      Top             =   1500
      Width           =   960
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "用户名:"
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C000C0&
      Height          =   240
      Left            =   1320
      TabIndex        =   4
      Top             =   540
      Width           =   960
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "旧密码:"
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C000C0&
      Height          =   240
      Left            =   1320
      TabIndex        =   3
      Top             =   1020
      Width           =   960
   End
End
Attribute VB_Name = "Form8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rst As New ADODB.Recordset
Dim con As New ADODB.Connection
Dim m, t As Integer
Private Sub Command1_Click()
If Combo1.Text <> "" Then
    rst.Open "select 密码,用户名 from 管理 where 密码='" & Trim(Text1.Text) & "' and 用户名='" & Trim(Combo1.Text) & "'", con, adOpenDynamic, adLockReadOnly
    If rst.EOF = False And rst.BOF = False Then
            m = MsgBox("你确定修改吗?", vbOKCancel)
         If m = 1 Then
            If Text2.Text <> "" Then
                rst.Close
                rst.Open "UPDATE 管理 SET 密码='" & Trim(Text2.Text) & "'where 用户名='" & Combo1.Text & "'"
                MsgBox ("修改成功!")
                Text1.Text = ""
                Text2.Text = ""
                Combo1.Text = ""
                Combo1.SetFocus
                Unload Me
            Else
                MsgBox "为了数据库的安全,用户必须设置密码!", 48
                Text2.SetFocus
                Set rst = Nothing
            End If
        Else
            Text1.Text = ""
            Text2.Text = ""
            Combo1.Text = ""
            Combo1.SetFocus
        End If
    Else
        m = MsgBox("原密码错误!请重试", 48)
        Text1.Text = ""
        Text1.SetFocus
        Set rst = Nothing
    End If
Else
    MsgBox "请选择一个用户进行修改密码的操作!", 48
    Set rst = Nothing
End If
End Sub
Private Sub Command2_Click()
    Me.Hide
End Sub
Private Sub Form_Load()
Set con = New ADODB.Connection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=gzgl.mdb;Persist Security Info=False"
con.CursorLocation = adUseClient
con.Open
rst.Open "select 用户名 from 管理", con, adOpenStatic, adLockReadOnly
Dim i As String
For t = 0 To Val(rst.RecordCount) - 1
    i = rst.Fields("用户名").Value
    rst.MoveNext
    Combo1.AddItem i
Next t
rst.Close
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    Call Command1_Click
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    Call Command1_Click
End If
End Sub

⌨️ 快捷键说明

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