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

📄 form12.vb

📁 是一个酒店管理信息系统。 用VB.NET以及SQL开发 包括程序
💻 VB
📖 第 1 页 / 共 2 页
字号:
        'Button2
        '
        Me.Button2.BackColor = System.Drawing.Color.Transparent
        Me.Button2.Location = New System.Drawing.Point(120, 230)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(72, 30)
        Me.Button2.TabIndex = 11
        Me.Button2.Text = "修改密码"
        '
        'Button3
        '
        Me.Button3.BackColor = System.Drawing.Color.Transparent
        Me.Button3.Location = New System.Drawing.Point(227, 230)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(69, 30)
        Me.Button3.TabIndex = 12
        Me.Button3.Text = "退出"
        '
        'PictureBox1
        '
        Me.PictureBox1.BackgroundImage = CType(resources.GetObject("PictureBox1.BackgroundImage"), System.Drawing.Image)
        Me.PictureBox1.Location = New System.Drawing.Point(240, 16)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(107, 200)
        Me.PictureBox1.TabIndex = 13
        Me.PictureBox1.TabStop = False
        '
        'Form12
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackColor = System.Drawing.SystemColors.ControlLight
        Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
        Me.ClientSize = New System.Drawing.Size(352, 269)
        Me.Controls.Add(Me.PictureBox1)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.ComboBox1)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.TextBox4)
        Me.Controls.Add(Me.TextBox3)
        Me.Controls.Add(Me.TextBox2)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label1)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.MaximizeBox = False
        Me.Name = "Form12"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "管理员设置"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.main.Show()
        Me.main.WindowState = FormWindowState.Normal
        Me.Close()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            Select Case ""
                Case TextBox1.Text
                    MessageBox.Show("name can't be null! ", "alarm", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                Case ComboBox1.Text
                    MessageBox.Show("position can't be null! ", "alarm", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                Case TextBox2.Text
                    MessageBox.Show("acount can't be null! ", "alarm", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                Case (TextBox3.Text)
                    MessageBox.Show("password can't be null! ", "alarm", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                Case (TextBox4.Text)
                    MessageBox.Show("password can't be null! ", "alarm", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                Case Else
                    If Trim(TextBox3.Text) <> Trim(TextBox4.Text) Then
                        MessageBox.Show("您输入的密码不一致! ", "alarm", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                    Else
                        Dim name As String = Trim(TextBox1.Text)
                        Dim position As String = Trim(ComboBox1.Text)
                        Dim count As String = Trim(TextBox2.Text)
                        Dim password As String = Trim(TextBox3.Text)
                        Dim level As String
                        Select Case position.Trim
                            Case "普通操作员"
                                level = 3
                            Case "经理"
                                level = 2
                            Case "管理员"
                                level = 1
                        End Select
                        Dim cn As New SqlConnection("data source=(local);initial catalog=酒店管理系统;uid=sa;pwd=;")
                        Dim str As String = "insert 操作员 values ('" & name & "','" & position & "','" & count & "','" & password & "','" & level & "')"
                        Dim cm As New SqlCommand(str, cn)
                        cn.Open()
                        If cm.ExecuteNonQuery = 1 Then
                            MessageBox.Show("添加管理员成功! ", "message", MessageBoxButtons.OK, MessageBoxIcon.Information)
                            cn.Close()
                        Else
                            MessageBox.Show("添加管理员失败! ", "message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
                            cn.Close()

                        End If
                        cn.Close()
                    End If
                    TextBox1.Text = ""
                    TextBox2.Text = ""
                    TextBox3.Text = ""
                    TextBox4.Text = ""
            End Select
        Catch ex As Exception
            Exit Sub
            MsgBox(ex.Message)

        End Try






    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Try
            Select Case ""
                Case TextBox1.Text
                    MessageBox.Show("name can't be null! ", "alarm", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                Case ComboBox1.Text
                    MessageBox.Show("position can't be null! ", "alarm", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                Case TextBox2.Text
                    MessageBox.Show("acount can't be null! ", "alarm", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                Case (TextBox3.Text)
                    MessageBox.Show("password can't be null! ", "alarm", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                Case (TextBox4.Text)
                    MessageBox.Show("password can't be null! ", "alarm", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                Case Else
                    If Trim(TextBox3.Text) <> Trim(TextBox4.Text) Then
                        MessageBox.Show("您输入的密码不一致! ", "alarm", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                    Else
                        Dim name As String = Trim(TextBox1.Text)
                        Dim position As String = Trim(ComboBox1.Text)
                        Dim count As String = Trim(TextBox2.Text)
                        Dim password As String = Trim(TextBox3.Text)
                        Dim level As String
                        Select Case position.Trim
                            Case "普通操作员"
                                level = 3
                            Case "经理"
                                level = 2
                            Case "管理员"
                                level = 1
                        End Select
                        Dim cn As New SqlConnection("data source=(local);initial catalog=酒店管理系统;uid=sa;pwd=;")
                        Dim str As String = "update 操作员 set 密码='" & password & "'" & "where 姓名='" & name & "'"
                        Dim cm As New SqlCommand(str, cn)
                        cn.Open()
                        If cm.ExecuteNonQuery = 1 Then
                            MessageBox.Show("管理员密码更新成功! ", "message", MessageBoxButtons.OK, MessageBoxIcon.Information)
                            TextBox1.Text = ""
                            TextBox2.Text = ""
                            TextBox3.Text = ""
                            TextBox4.Text = ""
                        End If
                        cn.Close()
                    End If

            End Select
        Catch ex As Exception
            Exit Sub
            MsgBox(ex.Message)
        End Try


    End Sub

End Class

⌨️ 快捷键说明

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