Typed dataset insert error

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hello,

I'm getting the following error:

"This row already belongs to another table. "

For this code:

while(myEnumerator.MoveNext())
{
myDS.myTable.Rows.Add((myDS.myTableRow) myEnumerator.Value);
}

This is a typed dataset, for which there is only one table, and the row
count is zero when I attempt to insert the row. So there can be no duplicate
table, since there's only one, and no duplicate record since there are no
rows.

Any idea why would I get the error?

Thanks. :)
 
There's only one table. There is no table #2, which is why I'm confused by
this error. ;)

If there's only one table in my dataset, what could this error mean?
 
Even then you could get this error - the fact that a row is attached to a
table is remembered inside the row object. So if you try and add an already
added row - even if it is to the same table - it'll give you this error.


- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
 

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

Back
Top