AFAIK,
Ado.net does not support aggregate functions, so you would have to write
code like as below on your datatable
int distinctcounter = 0;
foreach(DataRow row in yourtable.rows)
{
if(distinctcounter!= row["yourdistinctercolumn"])
{
newTable.AddRow(row);
distinctcounter= row["yourdistinctercolumn"];
}
}
Or if you wanna go hitech, create a second table that has primary keys that
match the column you wanna be distinct on, plus a count column. Then for
each row in your source table, add or update the count in this second table.
Then use DataTable.Rows.Find to find the matching row ... .. I know I know
it isn't fair, but life isn't either.
Does XPath let you do Uniques? Hmmmmm ..
Or hey look what I found
hehe -
http://support.microsoft.com/default.aspx?scid=kb;EN-US;326176
- Sahil Malik
Independent Consultant
You can reach me thru my blog -
http://dotnetjunkies.com/WebLog/sahilmalik/