shireenrao Posted October 1, 2003 Posted October 1, 2003 Hello I have a DataGrid which is bound to a DataTable. I know that the way the DataTable works is, when I add a new row or do any changes to existing data, each Row's RowState changes. So depending on new RowState I fire different stored procuderes. For ctr = 0 To myTab.Rows.Count - 1 If myTab.Rows(ctr).RowState = DataRowState.Added Then 'fire insert stored procedure ElseIf myTab.Rows(ctr).RowState = DataRowState.Modified Then 'fire update stored procedure ElseIf myTab.Rows(ctr).RowState = DataRowState.Deleted Then 'fire delete stored procedure End If Next The problem is when I have deleted a row, and when I have looped the datatable to the point where I get to the row which is deleted, I try to access the row id(the first column of the row), so I can send that ID to the stored procedure. I try this by setting the value of the parameter by prm.value = myTab.Rows(ctr).Item(0) but I get an error saying this is not possible, as I am trying to get a deleted row. I even tried setting the DataRowVersion as original, but it still does not work. Anybody having any ideas please help.. Thanks Shireen Quote
Administrators PlausiblyDamp Posted October 1, 2003 Administrators Posted October 1, 2003 Have you tried using a dataview on the table and setting it's RowFilter and RowStateFilter properties to try and get the original row's contenents? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
shireenrao Posted October 1, 2003 Author Posted October 1, 2003 I am sorry about this, but this was not working because of my stored procedure. once I corrected the error, it was working. Shireen Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.