Linq is an abbreviation for Language Integrated Query. The idea of it is that you can write a query on a source of data inline as part of your code. It is particularly clever because Linq allows different providers to be used so that different types of data can be queried. There are Linq providers that are part of the .NET Framework for querying anything based on IEnumerable (including Lists, Collections, Arrays, etc.), XML, SQL Server databases (using Linq to SQL).
There are also providers available for querying Oracle, MySQL, various webservices (one of the earliest ones I came across was Linq to Amazon). It is a very powerful system with lots of flexibility.
Another point about Linq is that you can build queries on top of queries and depending on the provider, it only compiles and executes the final query when you try to access the data. For example, you could do a query like
Dim people = From p in DB.People Where p.FirstName=”John”
people = From p in people Where p.Surname=”Smith”
Once you try to access people, (eg. by looping through it), Linq will execute an SQL query something like
SELECT [ID], [FirstName], [Surname] FROM [Person] WHERE [Person].[FirstName]=’John’ AND [Person].[Surname]=’Smith’
- Linq Part 1 - What is Linq?
- Linq Part 2 - From
- Linq Part 3 - Query Format
No related posts.
Tags: .NET, .NET 3.5, Language Integrated Query, Linq, VB.NET











