Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

OK. I want to delete rows from DataGrid. I'm doing it like this:

Dim RowNumber as integer
RowNumber = Me.BindingContext(DataSet.Table1).Position
Me.DataSet.Table1.Rows(RowNumber).Delete

 

So, row number 'Me.BindingContext(DataSet.Table1).Position' is marked for deletion (it alsso disapears from DataGrid). The row is deleted, when I update DataSet from DataAdapter.

 

OK, It is all right through this point. But....

 

If I delete row nr. 8 (Me.BindingContext(DataSet.Table1).Position=8), then row nr. 9 gets number 8. And so on. I can not delete all rows using this method.

 

So my question is. How can I define 'real' row number. ????

 

PS: I'm deleteing selected row (in datagrid) by pressing a button.

Posted
What? You don't delete from the Datagrid, you delete from the Dataset bound to the datagrid. Treat the dataset as if it were a database and send it sql commands accordingly.
Posted
Ok, not Sql commands, but you can do everything through the dataset object that you can do with Sql. Are you showing one record at a time? After you delete the record are you calling dataAdapter.Update(dataSet)? Are the UPDATE, DELETE and INSERT commands set?

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...