I am using typed dataset(generated by VS 2005) that I merged to empty dataset (actually to class, derived from dataset).
When I am accessed a particular row and tried to read value of the row field, I've got
System.ArgumentException: Column <ColumnName> does not belong to table <TableName>. at System.Data.DataRow.CheckColumn(DataColumn column)
After debugging and digging into Designer generated code, I found that the cause is that
the generated typed-safe columns have property Table as null, when it is exspected to be a reference to owner table.
The fix was unexpectedely easy.
For merged tables it is required to call InitVars() method of generated Table class.
The Table InitVars() looks like the following
internal void InitVars() {
//For each table column
this.columnRetrieved = base.Columns["Retrieved"];
}
The function InitVars() is called in Table constructor and Clone, but is not called during Merge.
It as not a bug, but it should be considered when merge typed datasets into untyped one.