Hi,
Try:
var distinctRows = (from DataRow dRow in dt.Rows select new { AdmissionNo = dRow["AdmissionNo"], StudentName = dRow["StudentName"]}).Distinct();
You didn't specify the member names:
http://msdn.microsoft.com/en-us/library/vstudio/bb397696.aspx[
^]
If you do not specify member names in the anonymous type, the compiler gives the anonymous type members the same name as the property being used to initialize them. You must provide a name for a property that is being initialized with an expression, as shown in the previous example. In the following example, the names of the properties of the anonymous type are Color and Price.
var productQuery =
from prod in products
select new { prod.Color, prod.Price };
foreach (var v in productQuery)
{
Console.WriteLine("Color={0}, Price={1}", v.Color, v.Price);
}
But there're no properties being used to initialize the anonymous type, so you get an error.
Hope this helps.