I need this this sql query in c# :
Select cv.manv, cv.luong1h*ct.sogiolam
From congviec cv
inner join chitiet ct on cv.manv=ct.manv
How can I do it with LINQ to sql?
I need this this sql query in c# :
Select cv.manv, cv.luong1h*ct.sogiolam
From congviec cv
inner join chitiet ct on cv.manv=ct.manv
How can I do it with LINQ to sql?
from cv in congviec
join ct in chitiet on cv.manv equals ct.manv
select new { cv.manv, cv.luong1h*ct.sogiolam}
sorry my bad, see this edit for working solution
var list = (from cv in congviec
join ct in chitiet on cv.manv equals ct.manv
select new { cv.manv, Multiply = cv.luong1h*ct.sogiolam}).toList();
It would look almost the same in Linq
var ExampleVariable = (from cv in congviec
inner join ct chitiet
on cv.manv equals ct.manv
select new {
cv.manv,
//cv.luong1h*ct.sogiolam
Product = cv.luong1h*ct.sogiolam
}).ToList();
And using lambda expression, refer this link.
Hope this helps.