Wednesday, 3 October 2012

Basic LINQ Query





LINQ Queries



Basic LINQ Query Operators

From (Specify the Data Source)

In LINQ query first step is to specify the data source that you want to query.
Dim custdata = from  cust in customers
Filtering
Filtering the data. Query returns only those elements for which the expression is true.
Dim custdata = from  cust in customers                                            Where cust.city= “Delhi”
Ordering
Order by clause return the data in order which we asked for
Dim custdata = from  cust in customers                                            Where cust.city= “Delhi”
Order by cust.name ascending
Selecting
Select clause is used for specify the fields you want to incluse In the result.
Dim custdata = from  cust in customers                                            Where cust.city= “Delhi”
Order by cust.name ascending
Select cust.namr



No comments: