Problem when using DataTable.Row[x].Delete() - "no row at pos 5"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a really stupid problem I'm hoping to get help with.

The problem occurs if I delete rows from a dynamically built datatable.

ie:
CreateDataTable(); // creates the structure of the table
myTable.Rows[4].Delete();

now if I put that datatable back in a dataset and bind that ds to a grid, I
get the error "there is no row at position 216"

why oh why? Please help!
 
AiKeith,

I do not understand this row
now if I put that datatable back in a dataset

Do you first remove it from the dataset?

Do not forget that this add a new table
ds.tables.add(mytable)
This does not create a new table
dt = ds.tables(mytable) however just set a reference

I am curious what you mean with that sentence?

Cor
 
Back
Top