var query = (from c in db.data_qy
where c.UploadDate == yesterday && c.Cover == "prest"
select (c.Name)).OrderByDescending(a => a.UploadDate).Distinct();
Here, you are selecting
c.Name
and hence your
a
is no longer of type
data_qy
, it becomes a
string
.
Try this:
var query = (from c in db.data_qy
where c.UploadDate == yesterday && c.Cover == "prest"
select (c)).OrderByDescending(a => a.UploadDate).Distinct();
i.e. instead of selecting
c.Name
, select
c
, it should work.
EDIT:
Also, I see that you need only distinct
Name
s, so you can get them as:
var query = (from c in db.data_qy
where c.UploadDate == yesterday && c.Cover == "prest"
select (c)).OrderByDescending(a => a.UploadDate)
.Select(a => a.Name).Distinct();