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

📄 修改体检信息.aspx.vb

📁 用VB.NET做的软件工程课程设计
💻 VB
字号:
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports System.Data.SqlClient
Imports System.IO
Imports System.Data
Partial Class 体检信息
    Inherits System.Web.UI.Page


    Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim temp As String = Me.TextBox1.Text.ToString()
        Dim sqlConnectString As String = "data source=localhost; database=users;Integrated Security=SSPI; user Id=sa;password='';connection TimeOut=30;"
        Dim dCon = New SqlConnection(sqlConnectString)
        dCon.Open()
        Dim sql1 As String
        sql1 = "select * from checkinfo where empno='" + temp + "'"
        Dim comm2 = New SqlCommand(sql1, dCon)
        Dim mydatareader As SqlDataReader
        mydatareader = comm2.ExecuteReader()
        If mydatareader.Read() Then
            TextBox1.Text = mydatareader.GetString(0)
            TextBox2.Text = mydatareader.GetString(1)
            TextBox3.Text = mydatareader.GetString(2)
            TextBox4.Text = mydatareader.GetString(3)
            TextBox5.Text = mydatareader.GetString(4)
            TextBox6.Text = mydatareader.GetString(5)
            TextBox7.Text = mydatareader.GetString(6)
            TextBox8.Text = mydatareader.GetString(7)
            TextBox9.Text = mydatareader.GetString(8)
            Button3.Visible = False
            Button4.Visible = False
            Label3.Visible = True
            Label4.Visible = True
            Label5.Visible = True
            Label6.Visible = True
            Label7.Visible = True
            Label8.Visible = True
            Label9.Visible = True
            Label10.Visible = True
            Label11.Visible = True
            Label13.Visible = True
            TextBox2.Visible = True
            TextBox3.Visible = True
            TextBox4.Visible = True
            TextBox5.Visible = True
            TextBox6.Visible = True
            TextBox7.Visible = True
            TextBox8.Visible = True
            TextBox9.Visible = True
            Button1.Visible = True
            Button2.Visible = True
        Else
            MsgBox("无记录!")
            'Response.Redirect("管理员进入.aspx")
        End If


    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Trim(TextBox1.Text) = "" Or Trim(TextBox2.Text) = "" Or Trim(TextBox3.Text) = "" Or Trim(TextBox4.Text) = "" Or Trim(TextBox5.Text) = "" Then
            MsgBox("请输入完整!")
            'Response.Redirect("插入体检信息.aspx")
        Else

            If Asc(TextBox1.Text) < 48 Or Asc(TextBox1.Text) > 57 Then
                MsgBox("编号错误!")
            ElseIf Val(TextBox2.Text) < 0 Or Val(TextBox2.Text) > 300 Or Asc(TextBox2.Text) < 48 Or Asc(TextBox2.Text) > 57 Then
                MsgBox("身高输入有误!")
            ElseIf Val(TextBox3.Text) < 0 Or Val(TextBox3.Text) > 300 Or Asc(TextBox3.Text) < 48 Or Asc(TextBox3.Text) > 57 Then
                MsgBox("体重输入有误!")
            ElseIf Val(TextBox4.Text) < 0 Or Val(TextBox4.Text) > 2 Or Asc(TextBox4.Text) < 48 Or Asc(TextBox4.Text) > 57 Then
                MsgBox("视力输入有误!")
            ElseIf Val(TextBox5.Text) < 0 Or Val(TextBox5.Text) > 300 Or Asc(TextBox5.Text) < 48 Or Asc(TextBox5.Text) > 57 Then
                MsgBox("血压输入有误!")
            Else
                Dim temp As String = Me.TextBox1.Text.ToString()
                Dim sqlConnectString As String = "data source=localhost; database=users;Integrated Security=SSPI; user Id=sa;password='';connection TimeOut=30;"
                Dim dCon = New SqlConnection(sqlConnectString)
                dCon.Open()
                Dim sql1 As String
                sql1 = "update checkinfo set shenggao='" + TextBox2.Text + "',tizhong='" + TextBox3.Text + "',shili='" + TextBox4.Text + "',xueya='" + TextBox5.Text + "',gumidu='" + TextBox6.Text + "',gangongneng='" + TextBox7.Text + "',shenggongneng='" + TextBox8.Text + "' ,cheadv='" + TextBox9.Text + "' where empno='" + temp + "'"
                Dim comm = New SqlCommand(sql1, dCon)
                comm.ExecuteScalar()
                MsgBox("修改成功!")
                Response.Redirect("修改体检信息.aspx")
            End If
        End If
    End Sub

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        Response.Redirect("管理员进入.aspx")
    End Sub

    Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click
        Response.Redirect("管理员进入.aspx")
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub
End Class

⌨️ 快捷键说明

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