Beginning on Line 1840 of SqlHelper.cs there is this block of code:
for (int index=0; index < tableNames.Length; index++)
{
...
dataAdapter.TableMappings.Add(tableName, tableNames[index]);
tableName += (index + 1).ToString();
}
If I call the FillDataset method in this manner
SqlHelper.FillDataset(connection, "getContactsByPK", ds, new string[]
{"contact", "contact_address", "contact_phone", "contact_email"}, nCID);
I'm supposed to get a dataset that looks like the following:
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<contact>
...
</contact>
<contact_address>
...
</contact_address>
<contact_phone>
...
</contact_phone>
<contact_email>
...
</contact_email>
</NewDataSet>
instead I get
<NewDataSet>
<contact>
...
</contact>
<contact_address>
...
</contact_address>
<Table2>
...
</Table2>
<Table3>
...
</Table3>
</NewDataSet>
Notice the Table2 and Table3 table names. The problem is with this line
tableName += (index + 1).ToString();
The problem is that the value of index is appened to the tableName string which doesn't provide the correct value when the tables are mapped.
I'm thinking this line should read something like:
tableName = "Table" + (index + 1).ToString();
Changing that line results in the correct behavior.