ID | Name | City | ZipCode |
01 | Kenny | LA | 12345 |
02 | Peter | CA | 54321 |
03 | John | NY | 13125 |
04 | Jimmy | NY | 13125 |
Using the following two lines of codes if you want to get the non-duplicated city list:
string[] columnNames = new string[] { "City" }; DataTable dtCity = dtMembers.DefaultView.ToTable(true, columnNames);The result will be "LA, CA, NY".
Take a look of the DataView.ToTable() method and this discussion.
No comments:
Post a Comment