Application scenario: Filter, Query and other functions.
Description: Similar to where in the SQL command, it is scoped to filter, and the judging condition is the clause that is followed by it.
The where operation consists of 3 forms, namely the simple form, the relationship condition form, and the first () Form. The following examples are used for example:
1. Simple form:
Example: use where to filter customers in London
var = from inch db. Customers where= = "London" select C;
Again: Filter employees who are employed after 1994 years or later:
var = from inch db. Employees where>=DateTime(199411) Select e;
2. Relationship Condition form:
Filter products with inventory levels below the order point level but not broken:
var = from inch db. Products where<=&& ! p.discontinued select p;
Filter out products with UnitPrice greater than 10 or discontinued:
var = from inch db. Products where>| | p.discontinued Select p;
The following example calls a two-time where to filter out products that have unitprice greater than 10 and that have been discontinued.
vardb. Products. Where (p=> 10m). Where (p=p.discontinued);
3.First () Form:
Returns an element in the collection, with the essence of adding top (1) to the SQL statement.
Simple usage: Select the first shipper in a table.
= db. Shippers.first ();
Element: Select a single customer with CustomerID as "Bonap"
= = == "Bonap");
Condition: Select an order with freight greater than 10.00:
Order = = > 00M);
Where is the LINQ to SQL statement (1)