I have data table which has columns namely Amount,StartDate. I am trying to get particular amount value from Amount based on StartDate.
My code is as follows:
DataTable dtt =_dstt.Tables[0];
var res = from r in dtt.AsEnumerable()
where r.Field("StartDate") == Convert.ToDateTime(drpStartYear.SelectedValue));
select r.Field("Amount");
I am getting following error:
The type arguments for method 'System.Data.DataRowExtensions.Field(System.Data.DataRow, int)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
_dsst is DataSet which I populate from database.
Is there better way to do it?