Cls.Con.Close()
Try
Cls.Con.Open()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly, "ERROR")
End
End Try
Sql = "SELECT * FROM Employee where id='" & TextBox1.Text & "'"
Dim Cmd As New SqlCommand(Sql, Cls.Con)
Dim Rs As SqlDataReader = Cmd.ExecuteReader
If Rs.Read Then
TextBox2.Text = Rs("id")
TextBox3.Text = Rs("id")
TextBox4.Text = Rs("name_sur")
TextBox5.Text = Rs("levell")
TextBox6.Text = Rs("Em_saraly")
If TextBox5.Text = "พนักงานประจำ" Then
Cls.Con.Close()
Cls.Con.Open()
Sql = "SELECT * FROM Saraly_MM where id_em ='" & TextBox1.Text & "'"
Cmd = New SqlCommand(Sql, Cls.Con)
Rs = Cmd.ExecuteReader
If Rs.Read Then
TextBox7.Text = Rs("S_tum")
TextBox8.Text = Rs("Tax")
TextBox9.Text = Rs("saraly_day")
TextBox10.Text = Rs("Tax2")
Cls.Con.Close()
End If
End If