Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.UI.WebControls
Imports System.Web.Security
Partial Class Main_jong
Inherits System.Web.UI.Page
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim l As LinkButton = DirectCast(e.Row.FindControl("LinkButton1"), LinkButton)
l.Attributes.Add("onclick", "javascript:return " & "confirm('Are you sure you want to delete this record " & DataBinder.Eval(e.Row.DataItem, "id_jong") & "')")
End If
End Sub
Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim ConnString As String = ConfigurationManager.ConnectionStrings("RinDBConnectionString").ToString()
Dim sql2 As String = "update Room set status=@status where number_room=@number_room"
Using cn2 As New SqlConnection(ConnString), _
cmd As New SqlCommand(sql2, cn2)
cmd.Parameters.Add("@number_room", SqlDbType.VarChar, 20).Value = GridView1
Dim ว่าง As String
ว่าง = "@status"
cmd.Parameters.Add("@status", Data.SqlDbType.NVarChar).Value = "ว่าง"
cn2.Open()
cmd.ExecuteNonQuery()
End Using
End Sub
End Class