0
下面是代碼示例我無法確定返回類型,此函數屬於類clsExhibitorlist。我想將它綁定到我的gridview。如何從函數返回值與LINQ
public ??? GetExhibitorList(){
using (DataClasses1DataContext context = new DataClasses1DataContext())
{
var Exhibitors = from c in context.Companies
join b in context.Booths on c.CoID equals b.CoID
join bc in context.BoothCategories
on b.BoothID equals bc.BoothID
join sp in context.SubProductCategories
on bc.SubProdCatID equals sp.SubProdCatID
join p in context.ProductCategories on
sp.ProdCatID equals p.ProdCatID
orderby c.CoID
select new clsExhibitorList { c.CoID, c.CompanyName, b.FPCoName,p.ProdCatID,sp.SubProdCatID};
if (Keyword != "")
{
Exhibitors = Exhibitors.Where(c => c.CompanyName.Contains(Keyword));
}
if (ProdCatID != "")
{
Exhibitors = Exhibitors.Where(c => c.ProdCatID.Equals(ProdCatID.Split(',')));
}
if (SubProdCatID != "")
{
Exhibitors = Exhibitors.Where(c => c.SubProdCatID.Equals(SubProdCatID.Split(',')));
}
return Exhibitors;
}
}