我正在尝试将下面提到的 SQL 查询转换为 LINQ 查询
Qry = "select Announcement, StartDate, Enddate,Annkey from
Announcements "; Qry = Qry & " where Startdate <= #" & Today & "# "
Qry = Qry & " and Enddate >= #" & Today & "# " Qry = Qry + " order by
StartDate, Enddate";
到目前为止我所做的 -
public bool Selectdatafromannouncements()
{
List<Announcement> lstAnnounce = new List<Announcement>(
from l in objVaccinationContext.Announcements
where
l.StartDate.Value < DateTime.Today
&& l.EndDate.Value < DateTime.Today
orderby l.StartDate, l.EndDate
select new (l.Announcement1, l.StartDate, l.EndDate, l.AnnouncementID)
);
return true;
}
在 select new 附近出现错误(如预期的那样,请帮助我,我是 LINQ 的初学者