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

📄 gdhamendpass.frm

📁 齐鲁石化某分公司的数据采集管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form gdhAmendPass 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "修改密码"
   ClientHeight    =   3090
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   3  'Windows Default
   Begin VB.ComboBox Combo1 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Left            =   1440
      TabIndex        =   9
      Top             =   240
      Width           =   1455
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   375
      Left            =   2880
      TabIndex        =   8
      Top             =   2400
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "修改"
      Height          =   375
      Left            =   360
      TabIndex        =   7
      Top             =   2400
      Width           =   975
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      IMEMode         =   3  'DISABLE
      Index           =   3
      Left            =   1440
      PasswordChar    =   "*"
      TabIndex        =   6
      Top             =   1680
      Width           =   1455
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      IMEMode         =   3  'DISABLE
      Index           =   2
      Left            =   1440
      PasswordChar    =   "*"
      TabIndex        =   5
      Top             =   1200
      Width           =   1455
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      IMEMode         =   3  'DISABLE
      Index           =   1
      Left            =   1440
      PasswordChar    =   "*"
      TabIndex        =   4
      Top             =   720
      Width           =   1455
   End
   Begin VB.Label Label1 
      Caption         =   "确认密码"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   3
      Left            =   240
      TabIndex        =   3
      Top             =   1680
      Width           =   975
   End
   Begin VB.Label Label1 
      Caption         =   "新密码"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   2
      Left            =   240
      TabIndex        =   2
      Top             =   1200
      Width           =   975
   End
   Begin VB.Label Label1 
      Caption         =   "原密码"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   1
      Left            =   240
      TabIndex        =   1
      Top             =   720
      Width           =   975
   End
   Begin VB.Label Label1 
      Caption         =   "用户名"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   0
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   975
   End
End
Attribute VB_Name = "gdhAmendPass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
    Dim db As New Adodb.Connection
    Dim rs As Adodb.Recordset
    Dim Query As String
    Dim i As Long
    
    If Checking = False Then
        Exit Sub
    End If
    
    db.CursorLocation = adUseClient
    db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\admin.mdb;Jet OLEDB:Database Password=dfrwadmin;"
    If db.State <> 1 Then
        Exit Sub
    End If
    
    Query = "update users set 密码='" & Text1(2).text & "' where 用户名='" & Combo1.text & "' and 密码='" & Text1(1).text & "'"
    Set rs = db.Execute(Query, i)
    
    If i = 0 Then
        MsgBox "用户名或密码错误,请更正"
    Else
        MsgBox "修改成功,请记住新密码!"
    End If
    db.Close
End Sub

Function Checking() As Boolean
    If Combo1.text = "" Then
        MsgBox "用户名不能为空"
        Exit Function
    End If
    If Combo1.text = "" Then
        MsgBox "原密码不能为空"
        Exit Function
    End If
    If Text1(2).text = "" Then
        MsgBox "新密码不能为空"
        Exit Function
    End If
    If Text1(2).text <> Text1(3).text Then
        MsgBox "密码前后输入不一致"
        Exit Function
    End If
    
    Checking = True
End Function

Private Sub Command2_Click()
    Unload Me
End Sub

Function setCenter()
    Dim X0 As Long
    Dim Y0 As Long
    X0 = Screen.Width
    Y0 = Screen.Height
    X0 = (X0 - Me.Width) / 2
    Y0 = (Y0 - Me.Height) / 2
    Me.Move X0, Y0
End Function

Private Sub Form_Load()
    Call setCenter
    Combo1.text = Usering_Name
    If AdminIF = True Then
        Combo1.Locked = False
    Else
        Combo1.Locked = True
    End If
    Call LoadUsers
End Sub

Private Sub Form_Unload(Cancel As Integer)
    gdhMain.Enabled = True
End Sub

Function LoadUsers()
    Dim db As New Adodb.Connection
    Dim rs As New Adodb.Recordset
    Dim Query As String
    On Error GoTo ok
    
    db.CursorLocation = adUseClient
    db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\admin.mdb;Jet OLEDB:Database Password=dfrwadmin;"
    If db.State <> 1 Then
        Exit Function
    End If
    
    Query = "select * from users order by 创建时间 ASC"
    rs.Open Query, db, adOpenDynamic, adLockOptimistic
    If Not rs.BOF And Not rs.EOF Then
        rs.MoveFirst
        Do While Not rs.EOF
            Combo1.AddItem Trim(rs.Fields("用户名"))
            rs.MoveNext
        Loop
'        Text1.SetFocus
        rs.Close
        db.Close
    End If
       
    Exit Function
ok:
    If db.State = 1 Then
        db.Close
    End If
End Function

⌨️ 快捷键说明

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