This is not working. Returns Null to dept_list.
var dept_list = ((from map in DtMapGuestDepartment.AsEnumerable()
where map.Field<Nullable<long>>("Guest_Id") == 174
select map.Field<Nullable<long>>("Department_id")).Distinct())as IEnumerable<DataRow>;
DataTable dt = dept_list.CopyToDataTable(); //dept_list comes null here
This works as desired.
var dept_list = from map in DtMapGuestDepartment.AsEnumerable()
where map.Field<Nullable<long>>("Guest_Id") == 174
select map;
DataTable dt = dept_list.CopyToDataTable(); //when used like this runs correct.
What mistake is being done by me here. ?