循環我有一個數據表:C#中通過不同的值DataTable中
+----------+--------+
| Rep Name | Volume |
+----------+--------+
| Alex | 9 |
| Alex | 1 |
| Alex | 3 |
| Liza | 24 |
| Liza | 17 |
| Pam | 0 |
| Pam | 6 |
+----------+--------+
我在發送一個電子郵件爲每個獨特的人REP NAME
例如:
Hi Alex, Today your volume was 9, and 1, and 3.
下一封郵件:
Hi Liza, Today your valume was 24, and 17.
我想通過對REPNAME
類似唯一值的數據表就知道循環的最簡單的方法:
var DistinctList = datatable123.Select(x=> x.repname).Distinct();
,然後我會遍歷DistinctList?
@Wesley var DistinctList = datatable123.Select(x => x.repname).Distinct(); – 2012-03-20 00:19:11
@韋斯利也這個我已經嘗試var list = from x in datatable123 group x by x.repname into g select g; – 2012-03-20 00:51:42