3 Comments

  • Good overview. This bug is also described in detail on the GotDotNet workspace for Data Access. Anyone interested in discussing the DAAB is more than welcome to join.



    Thanks



    Jason

  • I would argue that the line should also be moved before the actual fill. As the code stands (after the modification above), the table names will be Table, Table1, Table2



    The first table is not named consistently with the others. Moving the tablename concatenation before the fill would provide more consistent results:

    tableName = "Table" & (index + 1).ToString()

    dataAdapter.TableMappings.Add(tableName, tableNames(index))



    This would result in Table1, Table2, Table3, which in my opinion is better. Others may disagree.

  • Hey i'm guilty for that bug... I have solved this one and there will be a new version of the DAAB which supports an abstract factory so you can use the same code to call different ADO.NET providers... it will be available on the workspace this week.



    Your solution is not totally correct because the tables must be named Table, Table1, Table2, and so on. So the correct code is:

    In C#:

    <pre>

    dataAdapter.TableMappings.Add(

    tableName + (index == 0 ? "" : index.ToString()),

    tableNames[index] );

    </pre>



    In VB.NET

    <pre>

    dataAdapter.TableMappings.Add(tableName + CType(IIf(index = 0, "", index.ToString()), String), tableNames(index))

    </pre>

Comments have been disabled for this content.