where clause

where keyword is defined as
where-clause ::= where predExpr
and used to filter elements from the source sequence. In the following example will be find all salaries of the employee "Kristen Merro" starting from 2000-01-14.
MySqlConnection conn = new MySqlConnection("SERVER=localhost; DATABASE=employees;UID=root;PASSWORD=");
var emp = new EmployeeDataContext(conn);

var lastSalaries = from e in emp.Employees
                    join s in emp.Salaries on e.EmpNo equals s.EmpNo
                    where e.FirstName == "Kristen" && e.LastName == "Merro"
                    && s.FromDate > new DateTime(2000, 01, 14)
                    select new { e.LastName, s.FromDate, s.Salary1 };

foreach (object b in lastSalaries)
    Console.WriteLine(b);

Listing 8.1

only instead of && (AND) operator the where clause can be chained as shown below
MySqlConnection conn = new MySqlConnection("SERVER=localhost; DATABASE=employees;UID=root;PASSWORD=");
var emp = new EmployeeDataContext(conn);

var lastSalaries = from e in emp.Employees
                    join s in emp.Salaries on e.EmpNo equals s.EmpNo
                    where e.LastName == "Merro"
                    where s.FromDate > new DateTime(2000, 01, 14)
                    where e.FirstName == "Kristen" 
                    select new { e.LastName, s.FromDate, s.Salary1 };

foreach (object b in lastSalaries)
    Console.WriteLine(b);

Listing 8.2

No comments:

HOWTO: Repair Logitech M325 Mouse

FixIt says that you will find single screw under CE label. It isn't always true.