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

📄 information.vb

📁 这是一个基于.NET平台
💻 VB
📖 第 1 页 / 共 3 页
字号:
        Me.AcceptButton = Me.Button5
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.BackColor = System.Drawing.SystemColors.Info
        Me.ClientSize = New System.Drawing.Size(864, 517)
        Me.Controls.Add(Me.DataGrid1)
        Me.Controls.Add(Me.Button7)
        Me.Controls.Add(Me.Button6)
        Me.Controls.Add(Me.Button3)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.GroupBox2)
        Me.Controls.Add(Me.GroupBox1)
        Me.Controls.Add(Me.GroupBox3)
        Me.Controls.Add(Me.Button4)
        Me.Name = "Form5"
        Me.Text = "人事档案资料"
        Me.GroupBox1.ResumeLayout(False)
        Me.GroupBox2.ResumeLayout(False)
        Me.GroupBox3.ResumeLayout(False)
        CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
        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.Dispose()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        str()
    End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        Dim strCon As String
        strCon = "Server=(local); Database=mydb; User Id=sa; Password=;"
        'Dim ds As DataSet = New DataSet
        'SearchSQL = "select biid,biname,bisex,bipe,bina,bihei,biwei,biaddress,bicd,biimage,dpname,jobname,bipol,bimarriage,bipo,bicome,biun,bimaj,bide,biphone,biemail,from bi,dp,job where bi.bidepart=dp.dpid and bi.bijob=job.jobid and biid ='" & TextBox15.Text & " '"
       
        If RadioButton1.Checked = True Then
            If TextBox15.Text = "" Then
                MsgBox("请输入员工编号!")
            Else
                ds.Clear()

                Dim tablename As String
                tablename = "bi"  '表的名称
                'Dim SearchSQL As String
                SearchSQL = "select biid as 员工编号,biname as 姓名,bisex as 性别,bipe as 民族,bina as 籍贯,bihei as 身高,biwei as 体重,biaddress as 家庭地址,bicd as 身份证号,dpname as 所属部门,jobname as 职务,bipol as 政治面貌,bimarriage as 婚姻状况,bipo as 职称,biun as 毕业院校,bimaj as 专业,bide as 学历,biphone as 联系电话,biemail 电子邮件 from bi,dp,job where bi.bidepart=dp.dpid and bi.bijob=job.jobid and biid='" & TextBox15.Text & " '"
                Try
                    Try
                        Dim ADOcmd As SqlDataAdapter
                        '建立DataSet对象 
                        'Dim ds As DataSet = New DataSet '建立ADODataSetCommand对象

                        Dim mytable As DataTable
                        Dim rownumber As Integer '定义一个整型变量来存放当前行数

                        '建立表单对象
                        ADOcmd = New SqlDataAdapter(SearchSQL, strCon)

                        '建立ADODataSetCommand对象
                        ADOcmd.Fill(ds, tablename) '取得表单
                        mytable = ds.Tables.Item(0) '取得名为table的表
                        DataGrid1.DataSource = mytable

                        rownumber = 0 '设置为第一行
                        myrow = mytable.Rows.Item(rownumber)
                        '取得第一行数据
                    Catch
                        'MsgBox("没有该员工!")
                    End Try

                    'Dim s As String

                    Str2() '调用函数
                    'End If
                Catch

                    MsgBox("没有该员工!", vbOKOnly + vbExclamation, "警告")
                End Try

            End If
        End If
        If RadioButton2.Checked = True Then

            ds.Clear()
            'Dim ds As New DataSet

            If TextBox15.Text = "" Then
                MsgBox("请输入员工身份证号!")
            Else

                'Dim ds As DataSet = New DataSet
                Dim tablename As String
                tablename = "bi"  '表的名称
                Dim SearchSQL As String
                SearchSQL = "select biid as 员工编号,biname as 姓名,bisex as 性别,bipe as 民族,bina as 籍贯,bihei as 身高,biwei as 体重,biaddress as 家庭地址,bicd as 身份证号,dpname as 所属部门,jobname as 职务,bipol as 政治面貌,bimarriage as 婚姻状况,bipo as 职称,biun as 毕业院校,bimaj as 专业,bide as 学历,biphone as 联系电话,biemail 电子邮件 from bi,dp,job where bi.bidepart=dp.dpid and bi.bijob=job.jobid and bicd='" & TextBox15.Text & " '"
                Try
                    Try
                        Dim ADOcmd As SqlDataAdapter
                        '建立DataSet对象 
                        ' Dim ds As DataSet = New DataSet '建立ADODataSetCommand对象

                        Dim mytable As Data.DataTable
                        Dim rownumber As Integer '定义一个整型变量来存放当前行数

                        '建立表单对象
                        ADOcmd = New SqlDataAdapter(SearchSQL, strCon)

                        '建立ADODataSetCommand对象
                        ADOcmd.Fill(ds, tablename) '取得表单
                        mytable = ds.Tables.Item(0) '取得名为table的表

                        DataGrid1.DataSource = mytable
                        rownumber = 0 '设置为第一行
                        myrow = mytable.Rows.Item(rownumber)
                        '取得第一行数据
                    Catch
                        'MsgBox("没有该员工!")
                    End Try
                    'Dim s As String

                    Str2()
                Catch
                    MsgBox("没有该员工!", vbOKOnly + vbExclamation, "警告")
                End Try
            End If
        End If
        If RadioButton3.Checked = True Then
            ds.Clear()

            If TextBox15.Text = "" Then
                MsgBox("请输入员工姓名!")
            Else

                Dim tablename As String
                tablename = "bi"  '表的名称
                'Dim SearchSQL As String
                SearchSQL = "select biid as 员工编号,biname as 姓名,bisex as 性别,bipe as 民族,bina as 籍贯,bihei as 身高,biwei as 体重,biaddress as 家庭地址,bicd as 身份证号,dpname as 所属部门,jobname as 职务,bipol as 政治面貌,bimarriage as 婚姻状况,bipo as 职称,biun as 毕业院校,bimaj as 专业,bide as 学历,biphone as 联系电话,biemail 电子邮件 from bi,dp,job where bi.bidepart=dp.dpid and bi.bijob=job.jobid and biname='" & TextBox15.Text & " '"
                Try
                    Try
                        Dim ADOcmd As SqlDataAdapter
                        '建立DataSet对象 
                        'Dim ds As DataSet = New DataSet '建立ADODataSetCommand对象

                        Dim mytable As Data.DataTable
                        Dim rownumber As Integer '定义一个整型变量来存放当前行数

                        '建立表单对象
                        ADOcmd = New SqlDataAdapter(SearchSQL, strCon)

                        '建立ADODataSetCommand对象
                        ADOcmd.Fill(ds, tablename) '取得表单

                        mytable = ds.Tables.Item(0) '取得名为table的表

                        DataGrid1.DataSource = mytable
                        rownumber = 0 '设置为第一行
                        myrow = mytable.Rows.Item(rownumber)
                        '取得第一行数据
                    Catch
                        'MsgBox("没有该员工!")
                    End Try
                    Str2()
                Catch
                    MsgBox("没有该员工!", vbOKOnly + vbExclamation, "警告")
                End Try
            End If
        End If

    End Sub

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        Label24.Text = "请输入员工编号"
        str()

    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        Label24.Text = "请输入身份证号"

        str()

    End Sub

    Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
        Label24.Text = "请输入姓名"
        str()

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Text = "" Then
            MsgBox("请输入员工编号!")

        ElseIf TextBox2.Text = "" Then
            MsgBox("请输入员工姓名!")

        ElseIf ComboBox1.Text = "对应的职务" Or ComboBox1.Text = "0:办公室副主任" Or ComboBox1.Text = "1:技术部副经理" Or ComboBox1.Text = "2:财务部副经理" Or ComboBox1.Text = "3:人事部副经理" Or ComboBox1.Text = "办公室副主任" Or ComboBox1.Text = "技术部副经理" Or ComboBox1.Text = "财务部副经理" Or ComboBox1.Text = "人事部副经理" Then
            MsgBox("请输入职务编号,在0-3范围内!")

        ElseIf ComboBox7.Text = "对应的部门" Or ComboBox7.Text = "0:办公室" Or ComboBox7.Text = "1:技术部" Or ComboBox7.Text = "2:财务部" Or ComboBox7.Text = "3:人事部" Or ComboBox7.Text = "办公室" Or ComboBox7.Text = "技术部" Or ComboBox7.Text = "财务部" Or ComboBox7.Text = "人事部" Then
            MsgBox("请输入部门编号,在0-3范围内!")
        ElseIf ComboBox2.Text = "请选择性别" Then
            MsgBox("请选择性别!")

        Else
            Dim strCon As String
            strCon = "Server=(local); Database=mydb; User Id=sa; Password=;"
            Dim Conn As New SqlConnection(strCon)
            Dim strSql As String = "insert into bi values('" & TextBox1.Text & "','" & TextBox2.Text & "','" & ComboBox2.Text & "','" & TextBox3.Text & "','" & TextBox8.Text & "','" & TextBox9.Text & "','" & TextBox10.Text & "','" & TextBox14.Text & "','" & TextBox7.Text & "','" & ComboBox7.Text & "','" & ComboBox1.Text & "','" & ComboBox3.Text & "','" & ComboBox4.Text & "','" & TextBox5.Text & "','" & TextBox4.Text & "','" & TextBox11.Text & "','" & ComboBox5.Text & " ','" & TextBox6.Text & " ','" & TextBox13.Text & " ')"

            Dim Cmd As New SqlCommand(strSql, Conn)
            Dim dtAdapter As New SqlDataAdapter
            dtAdapter.SelectCommand = Cmd
            Dim dsResult As New DataSet
            Conn.Open()

            dtAdapter.Fill(dsResult)
            Conn.Close()
            MsgBox("数据增加成功!", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "系统提示")
        End If
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        If TextBox1.Text = "" Then
            MsgBox("请输入员工编号!")

        ElseIf TextBox2.Text = "" Then
            MsgBox("请输入员工姓名!")

        ElseIf ComboBox1.Text = "对应的职务" Or ComboBox1.Text = "0:办公室副主任" Or ComboBox1.Text = "1:技术部副经理" Or ComboBox1.Text = "2:财务部副经理" Or ComboBox1.Text = "3:人事部副经理" Or ComboBox1.Text = "办公室副主任" Or ComboBox1.Text = "技术部副经理" Or ComboBox1.Text = "财务部副经理" Or ComboBox1.Text = "人事部副经理" Then
            MsgBox("请输入职务编号,在0-3范围内!")

        ElseIf ComboBox7.Text = "对应的部门" Or ComboBox7.Text = "0:办公室" Or ComboBox7.Text = "1:技术部" Or ComboBox7.Text = "2:财务部" Or ComboBox7.Text = "3:人事部" Or ComboBox7.Text = "办公室" Or ComboBox7.Text = "技术部" Or ComboBox7.Text = "财务部" Or ComboBox7.Text = "人事部" Then
            MsgBox("请输入部门编号,在0-3范围内!")

        Else
            Dim strCon As String
            strCon = "Server=(local); Database=mydb; User Id=sa; Password=;"
            Dim Conn As New SqlConnection(strCon)
            Dim strSql As String = "update bi set biname='" & TextBox2.Text & "',bisex='" & ComboBox2.Text & "',bipe='" & TextBox3.Text & "',bina='" & TextBox8.Text & "',bihei='" & TextBox9.Text & "',biwei='" & TextBox10.Text & "',biaddress='" & TextBox14.Text & "',bicd='" & TextBox7.Text & "',bidepart='" & ComboBox7.Text & "',bijob='" & ComboBox1.Text & "',bipol='" & ComboBox3.Text & "',bimarriage='" & ComboBox4.Text & "',bipo='" & TextBox5.Text & "',biun='" & TextBox4.Text & "',bimaj='" & TextBox11.Text & "',bide='" & ComboBox5.Text & " ',biphone='" & TextBox6.Text & " ',biemail='" & TextBox13.Text & " ' where biid='" & TextBox1.Text & "' "
            Dim Cmd As New SqlCommand(strSql, Conn)
            Dim dtAdapter As New SqlDataAdapter
            dtAdapter.SelectCommand = Cmd
            Dim dsResult As New DataSet
            Conn.Open()
            dtAdapter.Fill(dsResult)
            Conn.Close()
            MsgBox("信息修改成功!", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "系统提示")
        End If

    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        If TextBox1.Text = "" Then
            MsgBox("请输入员工编号!")
        Else
            Dim strCon As String
            strCon = "Server=(local); Database=mydb; User Id=sa; Password=;"
            Dim Conn As New SqlConnection(strCon)
            Dim strSql As String = "delete from bi where biid= '" & TextBox1.Text & "'"
            Dim Cmd As New SqlCommand(strSql, Conn)
            Dim dtAdapter As New SqlDataAdapter
            dtAdapter.SelectCommand = Cmd

            Dim dsResult As New DataSet
            Conn.Open()
            dtAdapter.Fill(dsResult)
            Conn.Close()
            MsgBox("信息删除成功!", MsgBoxStyle.Information + MsgBoxStyle.OKOnly, "系统提示")

        End If

    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim openFile1 As OpenFileDialog = New OpenFileDialog
        openFile1.InitialDirectory = "d:\\"
        openFile1.Filter = "txt files(*.bmp;*.jpg;*.gif)|*.bmp;*.jpg;*.gif|All files(*.*)|*.*"
        openFile1.FilterIndex = 1
        openFile1.RestoreDirectory = False

        If (openFile1.ShowDialog() = DialogResult.OK) Then
            PictureBox1.Image = PictureBox1.Image.FromFile(openFile1.FileName)
        End If
    End Sub

    Private Sub str()
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""
        TextBox6.Text = ""
        TextBox7.Text = ""
        TextBox8.Text = ""
        TextBox9.Text = ""
        TextBox10.Text = ""
        TextBox11.Text = ""
        TextBox13.Text = ""
        TextBox14.Text = ""
        ComboBox1.Text = "对应的职务"
        ComboBox7.Text = "对应的部门"
        ComboBox2.Text = "请选择性别"
        ComboBox3.Text = "请选择"
        ComboBox4.Text = "是否已婚"
        ComboBox5.Text = "最高学历"

        ds.Clear()
    End Sub

    Private Sub Str2()


        TextBox1.Text = ds.Tables(0).Rows(0).Item(0)
        TextBox2.Text = ds.Tables(0).Rows(0).Item(1)
        ComboBox2.Text() = ds.Tables(0).Rows(0).Item(2)
        TextBox3.Text = ds.Tables(0).Rows(0).Item(3)

        TextBox8.Text = ds.Tables(0).Rows(0).Item(4)
        TextBox9.Text = ds.Tables(0).Rows(0).Item(5)
        TextBox10.Text = ds.Tables(0).Rows(0).Item(6)

        TextBox14.Text = ds.Tables(0).Rows(0).Item(7)
        TextBox7.Text = ds.Tables(0).Rows(0).Item(8)
        ComboBox7.Text = ds.Tables(0).Rows(0).Item(9)
        ComboBox1.Text = ds.Tables(0).Rows(0).Item(10)

        ComboBox3.Text = ds.Tables(0).Rows(0).Item(11)
        ComboBox4.Text = ds.Tables(0).Rows(0).Item(12)
        TextBox5.Text = ds.Tables(0).Rows(0).Item(13)
        'DateTimePicker1.Value = ds.Tables(0).Rows(0).Item(15)

        TextBox4.Text = ds.Tables(0).Rows(0).Item(14)
        TextBox11.Text = ds.Tables(0).Rows(0).Item(15)
        ComboBox5.Text = ds.Tables(0).Rows(0).Item(16)
        TextBox6.Text = ds.Tables(0).Rows(0).Item(17)
        TextBox13.Text = ds.Tables(0).Rows(0).Item(18)

        'DateTimePicker1.Value = ds.Tables(0).Rows(0).Item(21)


    End Sub


End Class

⌨️ 快捷键说明

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