logo
Учебник_ПОА

Linq to sql

Use LINQ to SQL to access SQL Server and SQL Server Express databases through a strongly-typed object layer that you create by using the O/R Designer.

You can use the O/R Designer to map LINQ to SQL classes to tables in a database and then write LINQ queries to bind data to controls in your application. For example, the following LINQ query binds the results of a LINQ query (all customers from the United States) to a binding source of a DataGridView control.

var CustomersQuery = from customers in northwindSampleDataContext1.Customers

where customers.Country == "US"

select customers;

customerBindingSource.DataSource = CustomersQuery;

Note:

The O/R Designer currently does not support SQL Server Compact 3.5 databases.