Working with LINQ to SQL Querying



Retrieve a column name that start with specific alphabet
NorthwindDataConext  db = new NorthwindDataContext(); 

// query Gets list of Customers,City starts with "S"
var custname = from c in db.Customers
                where c.City.StartsWith("S")
                orderby c.City ascending
                select c; 
Retrieve maximum value of a column name
//.Will be translated to SELECT MAX(UnitPrice)FROM products in Sql
var val= (from p in db.Products select (p.UnitPrice)).Max()  ;

Share |

 Cant find the page you are looking for?
 Help us to improve by adding the content that you are looking for.
 Leave a feedback
 We look forward to hear your comments and feedback.