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

📄 修改密码.frm

📁 基于VB+SQL Server的零食销售管理系统设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form 密码修改 
   Caption         =   "修改密码"
   ClientHeight    =   5625
   ClientLeft      =   4560
   ClientTop       =   2445
   ClientWidth     =   7485
   LinkTopic       =   "Form2"
   Picture         =   "修改密码.frx":0000
   ScaleHeight     =   5625
   ScaleWidth      =   7485
   Begin VB.TextBox Text3 
      Height          =   495
      Left            =   3120
      TabIndex        =   7
      Top             =   2400
      Width           =   2295
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   3120
      TabIndex        =   6
      Top             =   1560
      Width           =   2295
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   3120
      TabIndex        =   5
      Top             =   720
      Width           =   2295
   End
   Begin VB.CommandButton canl 
      Caption         =   "取消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   3840
      TabIndex        =   3
      Top             =   3600
      Width           =   1215
   End
   Begin VB.CommandButton ok 
      Caption         =   "确定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   1200
      TabIndex        =   2
      Top             =   3600
      Width           =   1335
   End
   Begin VB.Label Label3 
      Caption         =   "请输入旧密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   4
      Top             =   840
      Width           =   2175
   End
   Begin VB.Label Label2 
      Caption         =   "请确定新密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   1
      Top             =   2520
      Width           =   2175
   End
   Begin VB.Label Label1 
      Caption         =   "请输入新密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   1680
      Width           =   2175
   End
End
Attribute VB_Name = "密码修改"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mycon As ADODB.Connection
Dim myres As ADODB.Recordset

Private Sub canl_Click()
Unload Me
系统主页.Show
    canl.Caption = "退出"
mycon.Close
Set mycon = Nothing
End Sub

Private Sub Form_Load()
Set mycon = New ADODB.Connection
mycon.Open "my", "sa"
Set myres = New ADODB.Recordset
Text1.Text = "": Text1.PasswordChar = "*"
Text2.Text = "": Text2.PasswordChar = "*"
Text3.Text = "": Text3.PasswordChar = "*"
End Sub
Private Sub ok_Click()
If Trim(Text1.Text = "") Then
        MsgBox "旧密码不能为空,请重新输入!", vbOKOnly + vbExclamation, "警告"
        Text1.SetFocus
        Text1.Text = ""
        Exit Sub
    End If
  If Trim(Text2.Text = "") Then
        MsgBox "新密码不能为空,请重新输入!", vbOKOnly + vbExclamation, "警告"
        Text2.SetFocus
        Text2.Text = ""
        Exit Sub
    End If
    If Trim(Text3.Text = "") Then
        MsgBox "确认密码不能为空,请重新输入!", vbOKOnly + vbExclamation, "警告"
        Text3.SetFocus
        Text3.Text = ""
        Exit Sub
    End If
    If Text2.Text <> Text3.Text Then
        MsgBox "两次输入的新密码不同,请重新输入!", vbOKOnly + vbExclamation, "警告"
        Text2.SetFocus
        Text2.Text = ""
        Text3.Text = ""
        Exit Sub
    End If
    Dim strSql As String
     strSql = "Select 用户名,登录密码 from 管理员信息 where 用户名 = '" & yonghuming & "'"
    myres.Open strSql, mycon, adOpenDynamic, adLockOptimistic
    If Trim(myres.Fields("登录密码")) <> Trim(Text1.Text) Then
        MsgBox "旧密码不对,请重新输入!", vbOKOnly + vbExclamation, "警告"
        Text1.SetFocus
        Text1.Text = ""
    Else
        strSql = "Update 管理员信息 set 登录密码 = '" & Text2.Text & "' where 用户名 = '" & yonghuming & "'"
        mycon.Execute strSql
        MsgBox "密码修改成功!", vbOKOnly + vbInformation, "提示"
        Text3.Text = ""
        Text1.Text = ""
        Text2.Text = ""
       'Unload Me
       canl.Caption = "退出"
       End If
    
End Sub

⌨️ 快捷键说明

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