📄 插入体检信息.aspx.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 Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
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 empno As String = Me.TextBox1.Text.ToString
Dim shengao As String = Me.TextBox2.Text
Dim tizhong As String = Me.TextBox3.Text
Dim shili As String = Me.TextBox4.Text
Dim xueya As String = Me.TextBox5.Text
Dim gumidu As String = Me.TextBox6.Text
Dim gangongneng As String = Me.TextBox7.Text
Dim shenggongneng As String = Me.TextBox8.Text
Dim docadv As String = Me.TextBox9.Text
Dim sql1 As String
sql1 = "select count(*) from empinfo where empinfo.empno='" + empno + "'"
Dim comm2 = New SqlCommand(sql1, dCon)
Dim count1 As Short
count1 = CShort(comm2.ExecuteScalar())
If Asc(empno) < 48 Or Asc(empno) > 57 Then
MsgBox("编号错误!")
'Response.Redirect("插入体检信息.aspx")
Else
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 count1 = 0 Then
MsgBox("你不是本公司职工")
' Response.Redirect("插入体检信息.aspx")
ElseIf Val(shengao) < 0 Or Val(shengao) > 300 Or Asc(shengao) < 48 Or Asc(shengao) > 57 Then
MsgBox("身高输入有误!")
ElseIf Val(tizhong) < 0 Or Val(tizhong) > 300 Or Asc(tizhong) < 48 Or Asc(tizhong) > 57 Then
MsgBox("体重输入有误!")
ElseIf Val(shili) < 0 Or Val(shili) > 2 Or Asc(shili) < 48 Or Asc(shili) > 57 Then
MsgBox("视力输入有误!")
ElseIf Val(xueya) < 0 Or Val(xueya) > 300 Or Asc(xueya) < 48 Or Asc(xueya) > 57 Then
MsgBox("血压输入有误!")
Else
Dim sqlselect As String
sqlselect = "select count(*) from checkinfo,empinfo where checkinfo.empno='" + empno + "'and checkinfo.empno=empinfo.empno"
Dim comm1 = New SqlCommand(sqlselect, dCon)
Dim count As Short = CShort(comm1.ExecuteScalar())
If count > 0 Or TextBox1.Text = String.Empty Then
MsgBox("已有该职工体检信息!")
'Response.Redirect("插入体检信息.aspx")
Else
Dim sql As String
sql = "insert into checkinfo values('" + empno + "','" + shengao + "','" + tizhong + "','" + shili + "','" + xueya + "','" + gumidu + "','" + gangongneng + "','" + shenggongneng + "','" + docadv + "')"
Dim comm = New SqlCommand(sql, dCon)
comm.ExecuteScalar()
MsgBox("插入成功!")
Response.Redirect("插入体检信息.aspx")
End If
End If
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 Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -