Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my query

SQL
var pcvDescResult = (from equip in _context.Equipment
                                     where equip.EquipmentId == equipment.PcvId
                                     select equip.EquipmentCode + " " + equip.SerialNo).FirstOrDefault();





Could you please help me how to write this query by using lambda expression.
Posted

Try this:
C#
var pcvDescResult = _context.Equipment.Where(equip => equip.EquipmentId == equipment.PcvId).Select(equip => equip.EquipmentCode + " " + equip.SerialNo).FirstOrDefault();
 
Share this answer
 
Try This .....

Equipment objTbl=_context.Equipment.SingleOrDefault(t=>t.EquipmentId ==t.PcvId)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900