Private Sub grdProdType_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grdProdType.DeleteCommand Dim strDelSQL As String strDelSQL = "DELETE FROM ProductType where ProdType_ID = " & Val(e.Item.Cells(2).Text.ToString) Dim oCn As New SqlConnection(SqlCn.ConnectionString.ToString) Dim dbComm As New SqlCommand(strDelSQL, oCn) oCn.Open() dbComm.ExecuteNonQuery() oCn.Close() BindProductTypeGrid() End Sub>Hi , does anybody have an idea on how to delete records using data grid? current i use the button column and insert the following code . I receive and error of "Object reference not set to an instance of an object" probably on "rowChange.Delete();" is check the MSDN and seems to exact. did i miss something? tnx.
"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams