G
Guest
I have to add some rows of data into a datatable say "DT" containing data queried from a database. The data queried is sorted on a column called currency. I have six rowsets of data each rowset is based on currency. This data needs to be added to table "DT". After adding these rows, DT has to be again sorted on Currency column so that the data added is not scattered. The table DT does not have any primary key
1) First I attempted to find the currency from the datatable DT using foreach loop and whenever I find the currency I add the rowset associated with currency, but by doing so the collection on which the enumerator works become invalid
The solution I had was to make a copy of the original table and then find the position of the data in the copy and add the rowset to the original dataset. I know this solution is ugly
This could have been easily resolved if .NET supported iterators that can provide methods to add data thourgh the iterator interface
Or if atleast datatable provided a way to give me the position of the datarow that was found based on certain criteria
Is there a better solution other than making a copy of the orignal table
Thank yo
Rav
1) First I attempted to find the currency from the datatable DT using foreach loop and whenever I find the currency I add the rowset associated with currency, but by doing so the collection on which the enumerator works become invalid
The solution I had was to make a copy of the original table and then find the position of the data in the copy and add the rowset to the original dataset. I know this solution is ugly
This could have been easily resolved if .NET supported iterators that can provide methods to add data thourgh the iterator interface
Or if atleast datatable provided a way to give me the position of the datarow that was found based on certain criteria
Is there a better solution other than making a copy of the orignal table
Thank yo
Rav