2015-02-08 62 views
0

我們有兩個tables.Equipment_Table和PicturesOfEquipment_Table。 我想表的設備的細節,和第二張照片返回設備。 Equipment_Table:EqID,TitleOfEquipment,評論 PicturesOfEquipment_Table:PicID,EqID,PictureName 功能是:在LINQ中連接2個表並返回多個行

public List<object> Return_Equipment(long GroupCode) 
    { 
     var td = from s in Entity.Equipment_Table 
       join r in Entity.PicturesOfEquipment_Table on s.EqID equals r.EqID 
       where s.ServiceGroupCode == GroupCode 
       select s; 


     return td.ToList(); 
    } 

但td.ToList()時發生錯誤。 無法隱式轉換類型 'System.Collections.Generic.List' 到 'System.Collections.Generic.List'

回答

0

只是要:

public List<object> Return_Equipment(long GroupCode) 
    { 
     var td = from s in Entity.Equipment_Table 
       join r in Entity.PicturesOfEquipment_Table on s.EqID equals r.EqID 
       where s.ServiceGroupCode == GroupCode 
       select s; 


     return td; 
    } 
+0

你試過了@TPRFPR? – clement 2015-02-10 07:41:05