Filtering a typed datatable problem
-
Hello, I have a strange problem using typed datasets. I have the following datatable in a typed dataset ChainDetail ----------- ChainID Code Description I've populated an instance of the datatable with 2 rows loaded from SQL server. Here's my problem... When I either use DataTable.Select or create a DataView and apply a filter to retrieve one row, the select/filter work fine however the datarow returned has FOUR columns. [0] contains ChainID [1] contains Code [2] contains {} [3] contains Description This means that I can't cast this to a ChainDetailDataRow, as column [2] should be Description. Any help or suggestions will be much appreciated! Thanks A Very Confused Blakey404
-
Hello, I have a strange problem using typed datasets. I have the following datatable in a typed dataset ChainDetail ----------- ChainID Code Description I've populated an instance of the datatable with 2 rows loaded from SQL server. Here's my problem... When I either use DataTable.Select or create a DataView and apply a filter to retrieve one row, the select/filter work fine however the datarow returned has FOUR columns. [0] contains ChainID [1] contains Code [2] contains {} [3] contains Description This means that I can't cast this to a ChainDetailDataRow, as column [2] should be Description. Any help or suggestions will be much appreciated! Thanks A Very Confused Blakey404
Hi, how many columns are returned from the query that populates the datatable? if you're using 'SELECT * FROM...' change it to 'SELECT ChainID, Code, Description FROM...' Perhaps you could post some of the code if this hasn't helped
"An eye for an eye only ends up making the whole world blind"
-
Hi, how many columns are returned from the query that populates the datatable? if you're using 'SELECT * FROM...' change it to 'SELECT ChainID, Code, Description FROM...' Perhaps you could post some of the code if this hasn't helped
"An eye for an eye only ends up making the whole world blind"
This is the strangest thing... That is exacly what my query looks like, its in a stored procedure. When i populate the datatable the three columns are there and correct... its only when i create a dataview or use .Select that the extra colum is inserted into my results!! i'm at home now but i will connect to work later on and give a code example... cheers for the reply
-
Hi, how many columns are returned from the query that populates the datatable? if you're using 'SELECT * FROM...' change it to 'SELECT ChainID, Code, Description FROM...' Perhaps you could post some of the code if this hasn't helped
"An eye for an eye only ends up making the whole world blind"
I've just had a brainwave... This datatable is populating a combobox, directly via databinding (datasource, datavalue etc) To clear the combo box i am setting it's index to -1... could this or something else related to the combobox be inserting my extra column? i bet it is. crap that's going to be fun to find.
-
I've just had a brainwave... This datatable is populating a combobox, directly via databinding (datasource, datavalue etc) To clear the combo box i am setting it's index to -1... could this or something else related to the combobox be inserting my extra column? i bet it is. crap that's going to be fun to find.
The databinding shouldn't be the problem here as that's very much a read-only action... then again, I've had all sorts of problems with the comboBox and datasource properties! Try removing the selection using .SelectedItem = null instead. Can you step through the code and find the point where the extra column is added? Good luck! Rob
"An eye for an eye only ends up making the whole world blind"
-
The databinding shouldn't be the problem here as that's very much a read-only action... then again, I've had all sorts of problems with the comboBox and datasource properties! Try removing the selection using .SelectedItem = null instead. Can you step through the code and find the point where the extra column is added? Good luck! Rob
"An eye for an eye only ends up making the whole world blind"
Here's one for anyone to look out for in the future (i feel like an idiot) the Description Column should really have been the "Name" column therefore when i loaded the results into the dataset the name column was blank and the description colum was created thanks for your help! A very tired but enlightened Blakey404