Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...