Can't use .Union with Linq due to

前端 未结 2 1136
不思量自难忘°
不思量自难忘° 2021-01-04 08:12

I\'m kind of stuck with that problem. Hope i\'ll get some help. Here\'s the point. I have to fill my DataGridView with that SQL request :

SELECT LOT.NumLot,          


        
2条回答
  •  孤城傲影
    2021-01-04 08:46

    When I only look at your last try I see this:

    select new { x.NumLot, x.EtatLot, emp.NomEmploye };
    

    vs.

    select new { x.NumLot, x.EtatLot, test };
    

    You can never assign or cast one list of anonymous type to another as long as all their properties do not have equal type and name.

    EDIT: Write select new { x.NumLot, x.EtatLot, NomEmploye = test }; for the second one instead.

提交回复
热议问题