T-Sql ‘join’ command in Linq to Sql
Filed under: T-Sql to Linq Upgrade — admin @ 12:45 am
T-Sql exists Usage:
select c.CompanyName, o.*
from Customers c
join Orders o on o.CustomerId = c.CustomerId
where o.ShipCountry = ‘Germany’
Linq contains usage instead of exists:
DataClassesDataContext db = new DataClassesDataContext();
var Cust = from c in db.Customers
join o in db.Orders on c.CustomerID equals o.CustomerID
where o.ShipCountry == “Germany”
select new { c.CompanyName, o.OrderDate, o.ShipCountry };

No Comments»
No comments yet.
RSS feed for comments on this post. TrackBack URL
Leave a comment