This one has been mulled around for quite some time. Without looking at the
code, I believe you are correct, as the code is something like:
da.TableMappings.Add(tableName, mappedName);
tableName = "Table" + (index+1).ToString();
index++;
If the increment is before the setting of the new tableName, it is simply
index.ToString().
---
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
[quoted text, click to view] "Amidan" wrote:
> We're using the above mentioned Application Block in our project, in
> order to execute stored procedure (SQL-Server). One of the stored
> procedures executes a list of simple "select" commands, e.g. select *
> from tableX, select * from tableY etc.
> I used a string array in order to name the tables that are selected
> (TableMappings).
>
> I used one of the SqlHelper.FillDataset() overloads to execute my
> stored procedures, and to my surprise the table names were completely
> mismatched. After a short debugging session, it turned out that the
> code line :
> tableName += (index + 1).ToString();
> (line 1840, method signature: private static void
> FillDataset(SqlConnection connection, SqlTransaction transaction,
> CommandType commandType, string commandText, DataSet dataSet,
> string[]tableNames, params SqlParameter[] commandParameters)
> contains the bug. tableName starts as "Table", on the second pass
> it'll be "Table1", and on the third pass it'll be "Table12"!!! when it
> should be "Table3".
> the code line should be something like:
> tableName = "Table" + (index + 1).ToString();
>
> This fixes the problem.
>
> For your information,
> Amidan Roth,
> amidanr@log-on.com
> Log-On Software, Israel.