Bug In SQL Helper

G

Guest

I found a bug in the SQLHelper.FillDataSet method. I googled it but didn't find it and I didn't see anyway to provide feedback to MS so I'm posting it her

When filling a typed dataset that has more than two tables the table mapping doesn't work for any tables after the second table


The problem is on line 184


1835: string tableName = "Table"

1836: for (int index=0; index < tableNames.Length; index++

1837:

1838: if( tableNames[index] == null || tableNames[index].Length == 0 ) throw new ArgumentException( "The tableNames parameter must contain a list of tables, a value was provided as null or empty string.", "tableNames" )

1839: dataAdapter.TableMappings.Add(tableName, tableNames[index])

1840: tableName = (index + 1).ToString()

1841:

The tableName variable changes like so on each iteratio

Tabl
Table
Table1
Table12
....

It should change like

Tabl
Table
Table
Table
....

So 1840 should b

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


ConradF
 
C

Cowboy \(Gregory A. Beamer\) [MVP]

Yeah. I got that one a bit ago.
Change to this:

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

This one nabbed me when I created an OracleHelper from SQLHelper. Assumed it
was an Oracle FUBAR, not their code, but stepping into the block revealed I
was wrong.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************************************************
Think outside the box!
***************************************************************
Conrad F said:
I found a bug in the SQLHelper.FillDataSet method. I googled it but didn't
find it and I didn't see anyway to provide feedback to MS so I'm posting it
here
When filling a typed dataset that has more than two tables the table
mapping doesn't work for any tables after the second table.
The problem is on line 1840


1835: string tableName = "Table";

1836: for (int index=0; index < tableNames.Length; index++)

1837: {

1838: if( tableNames[index] == null || tableNames[index].Length == 0 )
throw new ArgumentException( "The tableNames parameter must contain a
list of tables, a value was provided as null or empty string.",
"tableNames" );
1839: dataAdapter.TableMappings.Add(tableName, tableNames[index]);

1840: tableName = (index + 1).ToString();

1841: }

The tableName variable changes like so on each iteration

Table
Table1
Table12
Table123
....

It should change like

Table
Table1
Table2
Table3
....

So 1840 should be

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



ConradF
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top