Protected Sub GridView1_RowCommand(ByVal source As Object, ByVal e As GridViewCommandEventArgs)
If e.CommandName = "Add" Then
Dim sql As String
'Dim txtdurStf_approv_num As TextBox = CType(GridView1.Rows(e.RowIndex).FindControl("txtdurStf_approv_num"), TextBox)
Dim txtdurStf_approv_num As TextBox = CType(GridView1.SelectedValue.FindControl("txtdurStf_approv_num"), TextBox)
'sql = "INSERT INTO tb_durStf_ann(durStf_approv_num) "
'sql += " VALUES ('" & txtdurStf_approv_num.Text & "') "
sql = "UPDATE tb_durStf_ann SET durStf_approv_num = '" & txtdurStf_approv_num.Text & "' "
sql += "WHERE durStf_id = '" & GridView1.DataKeys.Item(e.CommandArgument).Value & "'"
Response.Write(sql)
ObjDb.ExecuteNonQuery(sql)
Page.ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", "alert('บันทึกข้อมูลเรียบร้อย');", True)
BindData()
End If
End Sub