ASP.NET 3.5 C#
我使用Linq連接兩個表。
表名是MapAssets和ExitPoint。
在數據庫他們正在與相關的「有關係」如何從C中的函數返回Generic.List <Anonymoustype>#
我寫一個函數在我BLL返回連接表
public List<ExitPoints> GetExitPointDetailsByProjectID(int iProjectID)
{
ctx = new CoreDBDataContext();
var exitPointDetails = from ma in ctx.MapAssets
join ep in ctx.ExitPoints
on ma.MapAssetID equals ep.MapAssetID
where ma.ProjectID == iProjectID
select new
{
//would like to have data from both tables here
ctx.MapAssets,
ctx.ExitPoints
};
return exitPointDetails.ToList();
}
這obviuosly不起作用。我不知道該怎麼回報。
我對返回的所有約束都是可以綁定到gridview的。
這是正確的方法嗎?否則最好的方法是什麼?
他用3.5,不能使用動態。 – Phill 2010-12-10 12:03:46
在.net 3.5中沒有動態 – 2010-12-10 12:04:57
哦,對不起,我沒有注意到版本。編輯謝謝;) – digEmAll 2010-12-10 12:12:14