F
Faz
Have a strange problem using a sproc to populate a DataTable.
The sproc itself is fairly simple and returns a selection of columns from
three tables, a master table and two additional tables which are joined via
a LEFT JOIN.
The resultant DataTable schema after a fillschema looks good however after
a 'fill' the DataTable has two extra columns at the end which represent the
unselected columns from the two LEFT JOIN tables. These columns do not form
part of the SELECT statement yet are appearing in the DataTable with all
values set to null.
I have tried the same query with a DataReader and see the correct columns
(obviously executing the same sproc from query analyser shows the correct
column set) therefore it appears to be a DataAdaptor issue which is somehow
pulling down these unselected columns. This problem is a right pain as the
I am binding a DataGrid to the DataTable via a DataView and the extra
columns appear at the end of the grid.
I know I could remove the columns via TableStyles however I might change
the database schema at some point and I would need to know dynamically at
run-time which columns were garbage and at the moment I can't see any
properies on these columns which I could process against.
This looks like a bug to me therefore interested if anyone has come across.
Can post sample code (c#) and sproc if anyone would like to see.
Regards
Paul
The sproc itself is fairly simple and returns a selection of columns from
three tables, a master table and two additional tables which are joined via
a LEFT JOIN.
The resultant DataTable schema after a fillschema looks good however after
a 'fill' the DataTable has two extra columns at the end which represent the
unselected columns from the two LEFT JOIN tables. These columns do not form
part of the SELECT statement yet are appearing in the DataTable with all
values set to null.
I have tried the same query with a DataReader and see the correct columns
(obviously executing the same sproc from query analyser shows the correct
column set) therefore it appears to be a DataAdaptor issue which is somehow
pulling down these unselected columns. This problem is a right pain as the
I am binding a DataGrid to the DataTable via a DataView and the extra
columns appear at the end of the grid.
I know I could remove the columns via TableStyles however I might change
the database schema at some point and I would need to know dynamically at
run-time which columns were garbage and at the moment I can't see any
properies on these columns which I could process against.
This looks like a bug to me therefore interested if anyone has come across.
Can post sample code (c#) and sproc if anyone would like to see.
Regards
Paul