Dim GridID As String
Dim GridID2 As String
Dim row As GridViewRow = GridView1.SelectedRow
GridID2 = (row.Cells(2).Text)
GridID = (row.Cells(1).Text)
If GridID = 0 Then
Label2.Text = "ไม่สามารถแก้ไขได้"
Else
ds = New DataSet("GridView1")
sql = "SELECT * FROM Type WHERE TypeM_ID = '" & GridID & "'"
da = New SqlDataAdapter(sql, cn)
da.Fill(ds, "GridView1")
'Dim ii As Integer = ds.Tables("GridView1").Rows.Count - 1
'If ii = 0 Then
Dim drr As DataRow = ds.Tables("GridView1").Rows(0)
Label39.Text = drr("TypeM_ID") '555
TextBox6.Text = drr("TypeName")
Label51.Text = "<กำลังดำเนินการแก้ไขประเภทเวชภัณฑ์> รหัส"
'Label50.Text = drr("BringID")
Label50.Text = Label39.Text
'End If
End If
Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
If Label51.Text = "<กำลังดำเนินการแก้ไขประเภทเวชภัณฑ์> รหัส" Then
ds = New DataSet("editt")
sql = "SELECT * from Type WHERE TypeM_ID = '" & Label39.Text & "'"
da = New SqlDataAdapter(sql, cn)
da.Fill(ds, "editt")
Dim dreditt() As DataRow = ds.Tables("editt").Select
If dreditt.Length <> 0 Then
dreditt(0)("TypeName") = TextBox6.Text
sql = "select * from Type"
da = New SqlDataAdapter(sql, cn)
Dim cb = New SqlCommandBuilder(da)
da.Update(ds, "editt")
End If
GridView1.DataBind()
End If
End Sub