P
Philippe Bertrand
DataAdapter uses "Table", "Table1", "Table2", ... as the default table names
and "Column1", "Column2", ... as the default name for unnamed source columns
but
DataTableMapping uses "SourceTable1", "SourceTable2", ... as the default
table mapping names and "SourceColumn1", "SourceColumn2", ... as the default
source column name
hence you can't quickly map unnamed columns
da = new DataAdapter( "SELECT MIN(SomeCol), MAX(SomeCol) FROM SomeTable",
conn );
DataTableMapping dtm = da.TableMappings.Add( "", "" ); // Defaults
"SourceTable1", ""
dtm.ColumnMappings.Add( "", "Min" ); //
results "SourceColumn1", "Min"
dtm.ColumnMappings.Add( "", "Max" ); //
results "SourceColumn2", "Max"
da.Fill( dataSet ); // adds
Table "Table" with "Column1", "Column2"
Why is that? Or is MSDN Oct 2004 wrong? (.NET Framework 1.1)
Thanks,
Philippe
and "Column1", "Column2", ... as the default name for unnamed source columns
but
DataTableMapping uses "SourceTable1", "SourceTable2", ... as the default
table mapping names and "SourceColumn1", "SourceColumn2", ... as the default
source column name
hence you can't quickly map unnamed columns
da = new DataAdapter( "SELECT MIN(SomeCol), MAX(SomeCol) FROM SomeTable",
conn );
DataTableMapping dtm = da.TableMappings.Add( "", "" ); // Defaults
"SourceTable1", ""
dtm.ColumnMappings.Add( "", "Min" ); //
results "SourceColumn1", "Min"
dtm.ColumnMappings.Add( "", "Max" ); //
results "SourceColumn2", "Max"
da.Fill( dataSet ); // adds
Table "Table" with "Column1", "Column2"
Why is that? Or is MSDN Oct 2004 wrong? (.NET Framework 1.1)
Thanks,
Philippe