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

📄 frmadminmodify.vb

📁 图书管理系统,用来管理图书的借还,以及借阅超过时间进行处罚,和管理员用户权限
💻 VB
字号:
Imports System.Data
Imports System.Data.SqlClient
Public Class frmadminModify
    Inherits System.Windows.Forms.Form

#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 bnCancle As System.Windows.Forms.Button
    Friend WithEvents tbEmail As System.Windows.Forms.TextBox
    Friend WithEvents tbUsername As System.Windows.Forms.TextBox
    Friend WithEvents tbPwdConfirm As System.Windows.Forms.TextBox
    Friend WithEvents tbPwd As System.Windows.Forms.TextBox
    Friend WithEvents tbLoginname As System.Windows.Forms.TextBox
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents bnModify As System.Windows.Forms.Button
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents tbtelno As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmadminModify))
        Me.bnCancle = New System.Windows.Forms.Button
        Me.bnModify = New System.Windows.Forms.Button
        Me.tbEmail = New System.Windows.Forms.TextBox
        Me.tbUsername = New System.Windows.Forms.TextBox
        Me.tbPwdConfirm = New System.Windows.Forms.TextBox
        Me.tbPwd = New System.Windows.Forms.TextBox
        Me.tbLoginname = New System.Windows.Forms.TextBox
        Me.Label6 = New System.Windows.Forms.Label
        Me.Label5 = New System.Windows.Forms.Label
        Me.Label4 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.Label1 = New System.Windows.Forms.Label
        Me.GroupBox1 = New System.Windows.Forms.GroupBox
        Me.tbtelno = New System.Windows.Forms.TextBox
        Me.Label3 = New System.Windows.Forms.Label
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'bnCancle
        '
        Me.bnCancle.Location = New System.Drawing.Point(280, 88)
        Me.bnCancle.Name = "bnCancle"
        Me.bnCancle.Size = New System.Drawing.Size(88, 24)
        Me.bnCancle.TabIndex = 35
        Me.bnCancle.Text = "取消"
        '
        'bnModify
        '
        Me.bnModify.Location = New System.Drawing.Point(280, 40)
        Me.bnModify.Name = "bnModify"
        Me.bnModify.Size = New System.Drawing.Size(88, 24)
        Me.bnModify.TabIndex = 33
        Me.bnModify.Text = "修改"
        '
        'tbEmail
        '
        Me.tbEmail.Location = New System.Drawing.Point(88, 144)
        Me.tbEmail.Name = "tbEmail"
        Me.tbEmail.Size = New System.Drawing.Size(152, 21)
        Me.tbEmail.TabIndex = 29
        Me.tbEmail.Text = ""
        '
        'tbUsername
        '
        Me.tbUsername.Location = New System.Drawing.Point(88, 112)
        Me.tbUsername.Name = "tbUsername"
        Me.tbUsername.Size = New System.Drawing.Size(152, 21)
        Me.tbUsername.TabIndex = 28
        Me.tbUsername.Text = ""
        '
        'tbPwdConfirm
        '
        Me.tbPwdConfirm.Location = New System.Drawing.Point(88, 80)
        Me.tbPwdConfirm.Name = "tbPwdConfirm"
        Me.tbPwdConfirm.Size = New System.Drawing.Size(152, 21)
        Me.tbPwdConfirm.TabIndex = 27
        Me.tbPwdConfirm.Text = ""
        '
        'tbPwd
        '
        Me.tbPwd.Location = New System.Drawing.Point(88, 56)
        Me.tbPwd.Name = "tbPwd"
        Me.tbPwd.Size = New System.Drawing.Size(152, 21)
        Me.tbPwd.TabIndex = 26
        Me.tbPwd.Text = ""
        '
        'tbLoginname
        '
        Me.tbLoginname.Location = New System.Drawing.Point(88, 24)
        Me.tbLoginname.Name = "tbLoginname"
        Me.tbLoginname.ReadOnly = True
        Me.tbLoginname.Size = New System.Drawing.Size(152, 21)
        Me.tbLoginname.TabIndex = 125
        Me.tbLoginname.Text = ""
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(16, 80)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(72, 24)
        Me.Label6.TabIndex = 23
        Me.Label6.Text = "确认口令:"
        Me.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(32, 112)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(56, 24)
        Me.Label5.TabIndex = 22
        Me.Label5.Text = "姓名:"
        Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(32, 144)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(56, 24)
        Me.Label4.TabIndex = 21
        Me.Label4.Text = "email:"
        Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(32, 56)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(56, 24)
        Me.Label2.TabIndex = 19
        Me.Label2.Text = "口令:"
        Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(32, 24)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(56, 24)
        Me.Label1.TabIndex = 18
        Me.Label1.Text = "登录名:"
        Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.Add(Me.tbtelno)
        Me.GroupBox1.Controls.Add(Me.Label3)
        Me.GroupBox1.ForeColor = System.Drawing.Color.Red
        Me.GroupBox1.Location = New System.Drawing.Point(8, 8)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(256, 216)
        Me.GroupBox1.TabIndex = 32
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "修改用户资料"
        '
        'tbtelno
        '
        Me.tbtelno.Location = New System.Drawing.Point(80, 168)
        Me.tbtelno.Name = "tbtelno"
        Me.tbtelno.Size = New System.Drawing.Size(152, 21)
        Me.tbtelno.TabIndex = 146
        Me.tbtelno.Text = ""
        '
        'Label3
        '
        Me.Label3.ForeColor = System.Drawing.Color.Black
        Me.Label3.Location = New System.Drawing.Point(24, 168)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(56, 24)
        Me.Label3.TabIndex = 145
        Me.Label3.Text = "电话:"
        Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'frmadminModify
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(384, 245)
        Me.Controls.Add(Me.bnCancle)
        Me.Controls.Add(Me.bnModify)
        Me.Controls.Add(Me.tbEmail)
        Me.Controls.Add(Me.tbUsername)
        Me.Controls.Add(Me.tbPwdConfirm)
        Me.Controls.Add(Me.tbPwd)
        Me.Controls.Add(Me.tbLoginname)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.GroupBox1)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "frmadminModify"
        Me.Text = "---------修改管理员个人资料"
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region
    Public loginname As String
    Private Sub frmTrueModify_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim strSource As String = "server=CHANGHAIFENG;uid=sa;pwd=123;database=books"
        Dim strSelect As String = "select * from account where loginname = '" + loginname + "'"
        Dim conn As SqlConnection = New SqlConnection(strSource)
        conn.Open()
        Dim cmd As SqlCommand = New SqlCommand(strSelect, conn)
        Dim reader As SqlDataReader = cmd.ExecuteReader()

        If Not reader.HasRows Then
            Exit Sub
        End If

        reader.Read()

        tbLoginname.Text = reader.Item("loginname").ToString().Trim()
        tbPwd.Text = reader.Item("pwd").ToString().Trim()
        tbPwdConfirm.Text = reader.Item("pwd").ToString().Trim()
        tbUsername.Text = reader.Item("username").ToString().Trim()
        tbEmail.Text = reader.Item("email").ToString().Trim()
      

        conn.Close()

    End Sub

    Private Sub bnModify_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnModify.Click
        'Dim strSource As String = "workstation id=郭洪博;packet size=4096;integrated security=SSPI;initial catalog=books;persist security info=False"

        'If tbPwdConfirm.Text.Trim() <> tbPwd.Text.Trim() Then
        '    MessageBox.Show("两次口令不一致!")
        '    Exit Sub
        'End If
        'Dim strUpdate As String = "update account set pwd='" + tbPwd.Text.Trim() + "',username='" + tbUsername.Text.Trim() + "',email='" + tbEmail.Text.Trim() + "',class='" + tbClass.Text.Trim() + "',studNO=" + tbStudNo.Text.Trim() + " where loginname = '" + loginname + "'"
        'Dim conn As SqlConnection = New SqlConnection(strSource)
        'conn.Open()
        'Dim cmd As SqlCommand = New SqlCommand(strUpdate, conn)
        'Dim ret As Integer = cmd.ExecuteNonQuery()
        'If ret <> 1 Then
        '    MessageBox.Show("更新失败!")
        'Else
        '    MessageBox.Show("更新成功!")
        'End If
        'conn.Close()
    End Sub

    Private Sub bnCancle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnCancle.Click
        Me.Close()
    End Sub
End Class

⌨️ 快捷键说明

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