Sub btnDelete_OnClick(sender As Object, e As EventArgs)
Dim chkDel As CheckBox
Dim lblID As Label
Dim i As Integer
For i = 0 To myRepeater.Items.Count - 1
chkDel = myRepeater.Items(i).FindControl("chkDel")
lblID = myRepeater.Items(i).FindControl("lblCustomerID")
IF chkDel.Checked = True Then
strSQL = "DELETE FROM customer WHERE CustomerID = '"& lblID.Text &"' "
objCmd = New OleDbCommand(strSQL, objConn)
objCmd.ExecuteNonQuery()
End IF
Next
BindData()
End Sub
Dim chkDel As CheckBox
Dim lblID As Label
Dim i As Integer
For i = 0 To dgvBrand.Items.Count - 1
chkDel = dgvBrand.Items(i).FindControl("chkDel")
lblID = dgvBrand.Items(i).FindControl("lblCustomerID")
If chkDel.Checked = True Then
strSQL = "DELETE FROM customer WHERE CustomerID = '" & lblID.Text & "' "
commDelete = New OleDbCommand(strSQL, Conn)
commDelete.ExecuteNonQuery()
End If
Next
ตรง dgvBrand.Items มันมีเส้นสีน้ำเงินขีดเส้นใต้อยู่ พอเอาเมาส์ไปวางมันบอกว่า
'Item' is not a member of 'System.Windowns.Forms.DataGridView ค่ะ