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

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!
 
C

Cor Ligthert

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top