Mark Brown

Hmm...

<October 2008>
SuMoTuWeThFrSa
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678


Navigation

Work Links

Subscriptions

Post Categories

Article Categories



Bug in MS Data Application Block - Version 2 - FillDataset method

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.

posted on Wednesday, July 16, 2003 11:00 AM by MarkBrown





Powered by Dot Net Junkies, by Telligent Systems