我有这个 sql 语句:从 ActivityID = '"listACt"' 的故事中选择 FileURL;
我如何将其转换为 linq lambda?
我有这个,但它不工作:
public IList<Model.story> GetActivityList(int listAct)
{
IList<Model.story> lstImages = context.stories.ToList();
return lstImages.Where(c => c.ActivityID == listAct).ToList().Select( a => a.FileURL).ToList();
}
错误显示:不能隐式转换类型'System.Collections.Generic.List<string>' to 'System.Collections.Generic.IList<iStellarMobile.Model.story>'
。存在显式转换(您是否缺少演员表?)
编辑 - - - - - - - - - - - - - -
protected void btnSort_Click(object sender, EventArgs e)
{
if (dropListActivity.SelectedIndex > 0)
gvStory.DataSource = daoStory.GetActivityList(Convert.ToInt32(dropListActivity.SelectedItem.Value));
else
{ }
gvStory.DataBind();
}
使用 SWeko 的第二个代码后上述代码出错:
以下方法或属性之间的调用不明确:“iStellarMobile.DAO.DAOStory.GetActivityList(int)”和“iStellarMobile.DAO.DAOStory.GetActivityList(int)”