LINQ
ASP.NET

LINQ

LINQ

Language-Integrated Query (LINQ) is a query syntax built in c# and vb.net. Normally queries against data are expressed as simple strings without checking its type at compile time. Not only that you have to learn different query language for each type of datasources such as SQL databases ADO.NET datasets, XML document and so on. But LINQ helps us to store and get data from such kind of datasources. The most visible language-integrated part of LINQ is the query expression. Query expressed in a query syntax is known as query expression, which is used to query and to transform data from any LINQ-enabled data source. Similar to SQL or Xquery a query expression consists of set of clauses written in a declarative syntax, each clause in turn contains one or more c# expression and these expressions may be a query expression.

LINQ Architecture

A query expression starts with a from clause and ends with a select or group clause. Between the first and last clause, it may contain one or more optional clauses such as: where, orderby, join, let and even additional from clauses. You can also use into keyword to enable the result of a join or group clause to serve as the source for additional query clauses in the same query expression. You can perform filtering, ordering, joining and grouping on a data source by using the query syntax with minimum number of codes. Also You can use the same basic query expression patterns to query and transform data in SQL databases, ADO.NET datasets, XML documents and streams and .NET collections. The complete query operation takes place in following three steps.

1)declare a data source

2)defining the query expression and

3)executing the query in a foreach statement.

Author: STEPS

Leave a Reply

Your email address will not be published. Required fields are marked *