PsProductDataContext db = new PsProductDataContext();
public List<PsProduct> StaticReport()
{
return (from c in db.PsProduct
select c.ShCompanyName).ToList();
}
这段代码系统报 无法将类型“system.collection .generic.list<string>隐士转换为system.collection .generic.list<qdrkProductMvc.Models.PsProduct>,我把代码改为
public IQueryable<PsProduct> StaticReport()
{
return from c in db.PsProduct
select c.ShCompanyName;
}
还是报相同的错,请高手指教;
我用viewdata["ss"]=(... select c.ShCompanyName).ToList().在view中用foreach (List<Object> item in ViewData["ti"] as List<Object>)进行遍历,确报了未将对象运用到实例的错。迷糊。