如何更正此匿名类型转换错误?
Cannot implicitly convert type 'System.Linq.IQueryable<AnonymousType#1>' to 'System.Linq.IQueryable<object>'
发生在线
select new { ITEMID = p.PRESSRELEASEID };
代码
ddlYear.DataSource = years;
ddlYear.DataBind();
ddlYear.Items.Insert(0, new ListItem("Year", ""));
IQueryable<object> pressreleases;
DateTime startdate, enddate;
if (this.iFilterMonth != null && this.iFilterMonth > 0 && this.iFilterYear != null)
{
startdate = new DateTime((int)this.iFilterYear, (int)this.iFilterMonth, 1);
enddate = startdate.AddMonths(1);
pressreleases = from p in db.tblPressReleases
where p.prdate.Date >= startdate.Date && p.prdate.Date < enddate.Date
orderby p.prdate descending
select new { ITEMID = p.PRESSRELEASEID };
}
从建议的评论看起来像我在web.config中运行3.5?如果确实是我的错误的原因如何更改版本?
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.Services, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Data.Services.Client, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Abstractions, Version=3.5.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35" />