Dataset Merge -> Index was out of Range

M

Markus

Hi

The exception below is thrown when I merge a dataset into an other. I use a
typed dataset with more than one table. If I catch the excpetion everyting
works fine (dataset is merged, rowstate is up to date and I'm able to access
the data), but this shouldn't be necessary.

After much debugging I found a better solution: Call BeginLoadData before
calling Merge on each table and after call EndLoadData - this works fine :)

I think, the reason is that I have an eventhandler for RowChanged on the
DataSet...

Microsoft, please fix this! Or is there an other reason for this misterious
behavior?


EXCEPETION:
Index was out of range. Must be non-negative and less than the size of the
collection.
Parameter name: index

Exception: System.ArgumentOutOfRangeException
Method: System.Object get_Item(Int32)
Stack Trace:
at System.Collections.ArrayList.get_Item(Int32 index)
at System.Data.DataTable.RecordStateChanged(Int32 record,
DataViewRowState oldState, DataViewRowState newState)
at System.Data.DataTable.InsertRow(DataRow row, Int32 proposedID, DataRow
rowParent)
at System.Data.DataTable.MergeRow(DataRow row, DataRow targetRow, Boolean
preserveChanges, Index idxSearch)
at System.Data.Merger.MergeTable(DataTable src, DataTable dst)
at System.Data.Merger.MergeTableData(DataTable src)
at System.Data.Merger.MergeTable(DataTable src)
at System.Data.DataSet.Merge(DataTable table, Boolean preserveChanges,
MissingSchemaAction missingSchemaAction)
.....
 
K

Kevin Yu [MSFT]

Hi Markus,

From the stack trace, I think that there might be something wrong with the
eventhandler of RowChanged event. Can you paste some of your code here?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

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