2015-02-08 130 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

相关问题