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

📄 admin_changepw.vb

📁 图书馆管理系统,是数据库的课程设计,报告里面包含了需求分析数据字典概念结构设计逻辑结构设计数据库物理设计数据库实施
💻 VB
字号:
Imports System.Data
'引入数据库操作类命名空间
Imports System.Data.OleDb
'引入ADO.NET操作命名空间

Public Class win_adminchangepw
    Inherits System.Windows.Forms.Form
    Dim sqlstr As String 'SQL语句标记
    Dim objDS As DataSet '数据在内存中的缓存
    Dim login As New library2.win_login


#Region " Windows 窗体设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Windows 窗体设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加任何初始化

    End Sub

    '窗体重写 dispose 以清理组件列表。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Windows 窗体设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意: 以下过程是 Windows 窗体设计器所必需的
    '可以使用 Windows 窗体设计器修改此过程。
    '不要使用代码编辑器修改它。
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents btcancel As System.Windows.Forms.Button
    Friend WithEvents btreset As System.Windows.Forms.Button
    Friend WithEvents btOK As System.Windows.Forms.Button
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents tbConfirmpw As System.Windows.Forms.TextBox
    Friend WithEvents tbnewpw As System.Windows.Forms.TextBox
    Friend WithEvents tbpassword As System.Windows.Forms.TextBox
    Friend WithEvents Label4 As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(win_adminchangepw))
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.Label4 = New System.Windows.Forms.Label
        Me.btcancel = New System.Windows.Forms.Button
        Me.btreset = New System.Windows.Forms.Button
        Me.btOK = New System.Windows.Forms.Button
        Me.tbConfirmpw = New System.Windows.Forms.TextBox
        Me.tbnewpw = New System.Windows.Forms.TextBox
        Me.tbpassword = New System.Windows.Forms.TextBox
        Me.Label3 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label1 = New System.Windows.Forms.Label
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.Label4)
        Me.GroupBox1.Controls.Add(Me.btcancel)
        Me.GroupBox1.Controls.Add(Me.btreset)
        Me.GroupBox1.Controls.Add(Me.btOK)
        Me.GroupBox1.Controls.Add(Me.tbConfirmpw)
        Me.GroupBox1.Controls.Add(Me.tbnewpw)
        Me.GroupBox1.Controls.Add(Me.tbpassword)
        Me.GroupBox1.Controls.Add(Me.Label3)
        Me.GroupBox1.Controls.Add(Me.Label2)
        Me.GroupBox1.Controls.Add(Me.Label1)
        Me.GroupBox1.ForeColor = System.Drawing.SystemColors.ControlDark
        Me.GroupBox1.Location = New System.Drawing.Point(4, 2)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(280, 152)
        Me.GroupBox1.TabIndex = 1
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "修改登陆密码"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(56, 96)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(168, 16)
        Me.Label4.TabIndex = 18
        Me.Label4.Text = "系统自动过滤 ' "" + & | 字符"
        Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        Me.Label4.UseMnemonic = False
        '
        'btcancel
        '
        Me.btcancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.btcancel.ForeColor = System.Drawing.SystemColors.ControlText
        Me.btcancel.Location = New System.Drawing.Point(184, 120)
        Me.btcancel.Name = "btcancel"
        Me.btcancel.Size = New System.Drawing.Size(56, 24)
        Me.btcancel.TabIndex = 6
        Me.btcancel.Text = "关闭"
        '
        'btreset
        '
        Me.btreset.ForeColor = System.Drawing.SystemColors.ControlText
        Me.btreset.Location = New System.Drawing.Point(112, 120)
        Me.btreset.Name = "btreset"
        Me.btreset.Size = New System.Drawing.Size(56, 24)
        Me.btreset.TabIndex = 5
        Me.btreset.Text = "重置"
        '
        'btOK
        '
        Me.btOK.ForeColor = System.Drawing.SystemColors.ControlText
        Me.btOK.Location = New System.Drawing.Point(40, 120)
        Me.btOK.Name = "btOK"
        Me.btOK.Size = New System.Drawing.Size(56, 24)
        Me.btOK.TabIndex = 4
        Me.btOK.Text = "确定"
        '
        'tbConfirmpw
        '
        Me.tbConfirmpw.Location = New System.Drawing.Point(132, 72)
        Me.tbConfirmpw.MaxLength = 10
        Me.tbConfirmpw.Name = "tbConfirmpw"
        Me.tbConfirmpw.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.tbConfirmpw.Size = New System.Drawing.Size(88, 21)
        Me.tbConfirmpw.TabIndex = 3
        Me.tbConfirmpw.Text = ""
        '
        'tbnewpw
        '
        Me.tbnewpw.Location = New System.Drawing.Point(132, 48)
        Me.tbnewpw.MaxLength = 10
        Me.tbnewpw.Name = "tbnewpw"
        Me.tbnewpw.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.tbnewpw.Size = New System.Drawing.Size(88, 21)
        Me.tbnewpw.TabIndex = 2
        Me.tbnewpw.Text = ""
        '
        'tbpassword
        '
        Me.tbpassword.Location = New System.Drawing.Point(132, 16)
        Me.tbpassword.MaxLength = 10
        Me.tbpassword.Name = "tbpassword"
        Me.tbpassword.PasswordChar = Microsoft.VisualBasic.ChrW(42)
        Me.tbpassword.Size = New System.Drawing.Size(88, 21)
        Me.tbpassword.TabIndex = 1
        Me.tbpassword.Text = ""
        '
        'Label3
        '
        Me.Label3.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label3.Location = New System.Drawing.Point(60, 72)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(72, 24)
        Me.Label3.TabIndex = 11
        Me.Label3.Text = "确定密码:"
        Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label2
        '
        Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label2.Location = New System.Drawing.Point(60, 48)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(72, 24)
        Me.Label2.TabIndex = 10
        Me.Label2.Text = "新密码:"
        Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label1
        '
        Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
        Me.Label1.Location = New System.Drawing.Point(60, 16)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(72, 24)
        Me.Label1.TabIndex = 9
        Me.Label1.Text = "登陆密码:"
        Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'win_adminchangepw
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.CancelButton = Me.btcancel
        Me.ClientSize = New System.Drawing.Size(288, 157)
        Me.Controls.Add(Me.GroupBox1)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.MaximizeBox = False
        Me.MaximumSize = New System.Drawing.Size(296, 184)
        Me.MinimumSize = New System.Drawing.Size(296, 184)
        Me.Name = "win_adminchangepw"
        Me.Text = "图书馆管理系统--修改管理员密码"
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub btcancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btcancel.Click
        Close()
    End Sub

    Private Sub btreset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btreset.Click
        tbpassword.Text = ""
        tbnewpw.Text = ""
        tbConfirmpw.Text = ""
    End Sub

    Private Sub btOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btOK.Click
        Dim password As String, newpw As String, confirmpw As String, canupdate As Boolean = True
        password = filter(Trim(tbpassword.Text).ToString)
        newpw = filter(Trim(tbnewpw.Text).ToString)
        confirmpw = filter(Trim(tbConfirmpw.Text).ToString)
        If password = "" Then
            MessageBox.Show("管理员密码不能有空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Information)
            tbpassword.Focus()
            canupdate = False
        ElseIf newpw = "" Then
            MessageBox.Show("管理员新密码不能有空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Information)
            tbnewpw.Focus()
            canupdate = False
        ElseIf confirmpw = "" Then
            MessageBox.Show("管理员确认密码不能有空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Information)
            tbConfirmpw.Focus()
            canupdate = False
        ElseIf newpw <> confirmpw Then
            MessageBox.Show("两密码不一致!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Information)
            tbnewpw.Text = ""
            tbConfirmpw.Text = ""
            tbnewpw.Focus()
            canupdate = False
        End If

        If canupdate Then
            Try
                sqlstr = "update admininfo set lpassword = '" & newpw & "' where id=" & login.loginid & ""  '"select * from admininfo where lpassword = '" & password & "'" '判断新输入的帐号是否存在
                objDS = GetData(sqlstr)
                Me.Close()
                MessageBox.Show("更新密码成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Catch
                MsgBox("更新数据库错误。", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "错误")
            End Try
        End If
    End Sub
End Class

⌨️ 快捷键说明

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