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

📄 changepswd.frm

📁 用vb+access库房管理开放源码 1、日常业务 药品入库 药品出库 入库退单管理 出库退单管理 2、库存管理 库存查询 库存盘点 价格管理 3、查询统计 入库查询 入库退
💻 FRM
字号:
VERSION 5.00
Begin VB.Form changepswd 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "修改密码"
   ClientHeight    =   2520
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4980
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   2520
   ScaleWidth      =   4980
   ShowInTaskbar   =   0   'False
   Begin VB.PictureBox Picture1 
      BackColor       =   &H00C0C0C0&
      Height          =   2265
      Left            =   120
      ScaleHeight     =   2205
      ScaleWidth      =   4665
      TabIndex        =   0
      Top             =   90
      Width           =   4725
      Begin VB.TextBox txtold 
         BackColor       =   &H00C0FFFF&
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         IMEMode         =   3  'DISABLE
         Left            =   1560
         PasswordChar    =   "*"
         TabIndex        =   1
         Top             =   240
         Width           =   1635
      End
      Begin VB.TextBox txtnew 
         BackColor       =   &H00C0FFFF&
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         IMEMode         =   3  'DISABLE
         Left            =   1560
         PasswordChar    =   "*"
         TabIndex        =   2
         Top             =   840
         Width           =   1635
      End
      Begin VB.TextBox txtsec 
         BackColor       =   &H00C0FFFF&
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   300
         IMEMode         =   3  'DISABLE
         Left            =   1560
         PasswordChar    =   "*"
         TabIndex        =   3
         Top             =   1320
         Width           =   1635
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Default         =   -1  'True
         Height          =   435
         Left            =   3480
         TabIndex        =   4
         Top             =   930
         Width           =   945
      End
      Begin VB.CommandButton Command2 
         Cancel          =   -1  'True
         Caption         =   "退出"
         Height          =   435
         Left            =   3510
         TabIndex        =   5
         Top             =   1470
         Width           =   945
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "旧 密 码"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Left            =   120
         TabIndex        =   8
         Top             =   240
         Width           =   915
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "新 密 码"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Left            =   150
         TabIndex        =   7
         Top             =   840
         Width           =   915
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "确定密码"
         BeginProperty Font 
            Name            =   "楷体_GB2312"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Left            =   120
         TabIndex        =   6
         Top             =   1440
         Width           =   900
      End
   End
End
Attribute VB_Name = "changepswd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
'Download by http://www.codefans.net
Attribute VB_Exposed = False
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Dim rs As ADODB.Recordset
Dim oldpassword As String       '该变量用来存放获取的密码
Dim cn As ADODB.Connection
Dim oldflag As String

Private Sub Combo1_Click()
    txtold.SetFocus
End Sub
Function CheckString(s) As String
Dim pos As Integer
pos = InStr(1, s, "'")
While pos > 0
  s = Mid(s, 1, pos) & "'" & Mid(s, pos + 1)
  pos = InStr(pos + 2, s, "'")
  Wend
CheckString = "'" & s & "'"
End Function

                    '*********修改密码*********
Private Sub Command1_Click()
Dim name As String
Dim rs As ADODB.Recordset
Dim strsql
Dim t As VbMsgBoxResult
    Set rs = New ADODB.Recordset
    Set rs.ActiveConnection = cn
    rs.LockType = adLockOptimistic
    rs.CursorType = adOpenKeyset
    strsql = "select * from user_load where user_name=" & Me.CheckString(username)
    rs.open strsql
    oldpassword = rs.Fields("password") '获取密码'核对密码
    name = rs.Fields("user_name")

  If txtold.Text = oldpassword Then
   If txtnew.Text = txtsec.Text Then
       If txtnew.Text = "" Or txtsec.Text = "" Then
          t = MsgBox("请输入密码!", 48, "WARNING")
       Else                             '如满足条件,则更新密码
          
           rs.Fields("password") = txtnew.Text '是否有问题 ??
           rs.Update
           t = MsgBox("密码修改成功!", vbOKOnly, "SURE")
            
           txtold.Text = ""
           txtnew.Text = ""
           txtsec.Text = ""
       End If
    Else
        t = MsgBox("密码输入不同!", 48, "warning")
        txtnew.Text = ""
        txtsec.Text = ""
    End If
Else
    t = MsgBox("原密码错误!", 48, "warning")
    txtold.Text = ""
    txtnew.Text = ""
    txtsec.Text = ""
End If
End Sub

Private Sub Command2_Click()
If cn.State = 1 Then cn.close
Unload Me
End Sub

Private Sub Form_Load()
MyMenu = GetSystemMenu(Me.hwnd, 0)       '得到系统菜单的句柄,Me.hwnd表示当前窗体的句柄
RemoveMenu MyMenu, &HF060, MF_BYCOMMAND  '移去“关闭”菜单项,&HF060“关闭”菜单项的命令ID

Set cn = New ADODB.Connection
    'cn.Provider = "sqloledb"
    'cn.Properties("Data Source").Value = "JIMMY"       '建立与本地数据库的连接
    'cn.Properties("Initial Catalog").Value = "YAOFEI"   '数据库的名称
    'cn.Properties("Integrated Security").Value = "SSPI"
    cn.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0;Data source =" & App.Path & "/data/goodStock.mdb" '我转换的access数据库路径
    cn.open
   
End Sub


Private Sub Form_Unload(Cancel As Integer)
MainForm.StatusBar1.Panels(1).Text = "状态: 无"
End Sub

⌨️ 快捷键说明

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