Protected Sub btnSaveTime_Click(sender As Object, e As EventArgs) Handles btnSaveTime.Click
Dim Conn As SqlConnection = New SqlConnection("Data Source=BAS-PC\BAS;Initial Catalog=DBopd;User ID=sa;Password=........")
Conn.Open()
Dim SqlQuery As String = "UPDATE Time_chk SET TimeChkOut = @TimeChkOut , Status = 1 WHERE ID='" & Request("id") & "' "
Dim cmd As SqlCommand = New SqlCommand(SqlQuery, Conn)
cmd.Parameters.AddWithValue("@TimeChkOut", txtTimeChkOut.Text)
Dim result As Integer
result = cmd.ExecuteNonQuery()
If result > 0 And txtTimeChkOut.Text <> "" Then
MsgBox("บันทึกข้อมูลลงฐานข้อมูลเรียบร้อยแล้ว", MsgBoxStyle.Information, "Updation Complete")
Else
MsgBox("ไม่สามารถบันทึกได้", MsgBoxStyle.Information, "Updation not complete")
End If
End Sub
Protected Sub btnDeleteColumn_Click(sender As Object, e As EventArgs) Handles btnDeleteColumn.Click
Try
Dim SqlStr As String = "DELETE FROM Time_chk WHERE ID='" & Request("id") & "'"
Dim cmd As SqlCommand = ConnectDB.CreateCommand(SqlStr)
Dim inc As Integer = ConnectDB.Execute(cmd)
If inc > 0 Then
MsgBox("ลบข้อมูลเรียบร้อยแล้ว", MsgBoxStyle.Information, "Delete Complete")
End If
Catch ex As Exception
MsgBox("ไม่สามารถลบข้อมูลได้")
End Try
End Sub