พอดีเขียน code แบบ ให้ลบ user แต่ว่าติด erorr ไม่รู้ว่าจะแก้ยังไงดี ฝากดูด้วยนะคะ
Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
Dim conDB2 As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\tblUserName.mdb"
Dim con2 As New OleDbConnection(conDB2)
con2.Open()
Dim query2 As String
query2 = "DELETE FROM LAN WHERE CodeID = '" & GridView1.Rows(0).RowIndex & "' "
Dim com2 As New OleDbCommand(query2, con2)
com2.ExecuteNonQuery() 'error ตรงนี้คะ ว่า No value given for one or more required parameters.
Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
Dim conDB2 As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\tblUserName.mdb"
Dim con2 As New OleDbConnection(conDB2)
con2.Open()
Dim query2 As String
query2 = "DELETE FROM LAN WHERE ID = '" & GridView1.DataKeys(1)("ID").ToString & "'"
Dim com2 As New OleDbCommand(query2, con2)
com2.ExecuteNonQuery()
Dim query3 As String
query3 = "SELECT * FROM LAN ORDER BY ID"
Dim com3 As New OleDbCommand(query3, con2)
Dim myDA As New OleDbDataAdapter(com3)
Dim myDS As New DataSet
myDA.Fill(myDS)
GridView1.Visible = True
GridView1.EnableSortingAndPagingCallbacks = True
GridView1.DataSource = myDS
GridView1.DataBind()
myDS.Dispose()
myDA.Dispose()