Questions That Should Be Asked More Frequently

Q

How can I use ADO.NET features to generate a distinct list of values? I know I can use the DataTable’s Select method or the DataView’s RowFilter property to apply filters like "Country = ‘Spain’" and I can use either feature to list values for the corresponding rows, but in each case the resulting list of values can contain duplicates. Is there any way to use ADO.NET to generate lists that omit duplicate values?

A

The DataView class’s new ToTable method is designed to help you handle this scenario, which we covered earlier in the chapter. I’ve spoken with a number of developers who hadn’t noticed the new method and/or did not realize it could be used to generate distinct values, so I figured it was ...

Get Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.