Reputation: 57
I have a dataset in which I have three columns. It is a store database in which number of different goods are sold on a particular date. The date can be repeated. For example, for date one item A sold 5 units, item B sold 10, and C sold 15. Here the same date is repeated 3 times. For the next date similar data can be in the dataset. What I want is to get this date one time and make it the header in a datalist and show values of the other two columns in an inner datalist. Likewise I want to do the same for all other dates in that dataset.
Upvotes: 2
Views: 452
Reputation: 832
Supposing you have your data loadede in memory in a typed dataset, you could group it with LINQ:
var query = from salesRow in dataSet
group salesRow by salesRow.SoldDate;
// Do something with the query like iterate it, databanind it, etc.
Upvotes: 1
Reputation: 38200
I think it would be better if you can get the list separately from the database.
Else you will have to loop through and get the desired list.
Select, RowFilter
all these function like where clause so getting distinct via that won't be possible
Upvotes: 0