What is LINQ ?

LINQ is a programming model that introduces queries as a first-class concept into any Microsoft .NET language. Complete support for LINQ, however, requires some extensions in the language you are using. These extensions boost developer productivity, thereby providing a shorter, more meaningful, and expressive syntax with which to manipulate data

-Supported operating systems: Microsoft Windows Server 2003, Windows Server 2008, Windows Vista, Windows XP with Service Pack 2

-Microsoft Visual Studio 2008

- C# 3.0 ,VB.NET 11


Reference: http://msdn.microsoft.com/en-us/netframework/aa904594.aspx


Comments

Author: K'ran17 Jul 2009 Member Level: Gold   Points : 0

hi

very good link for who are learning to LINQ

keep post more

Author: Sajid P K24 Jul 2009 Member Level: Gold   Points : 1

Hi All,

Have look to given link. It teach you simple query in LINQ. You can also download complet source code for that from the link

http://www.dotnetspider.com/resources/30725-Simple-File-Search-Using-LINQ.aspx

Author: Sajid P K26 Nov 2010 Member Level: Gold   Points : 1

Language Integrated Query (LINQ) adds the ability to query objects using .NET languages. The LINQ to SQL object/relational mapping (O/RM) framework provides the following basic features:


Tools to create classes (usually called entities) mapped to database tables

Compatibility with LINQ's standard query operations

The DataContext class, with features such as entity record monitoring, automatic SQL statement generation, record concurrency detection

Author: Sajid P K26 Nov 2010 Member Level: Gold   Points : 1

Language Integrated Query (LINQ) adds the ability to query objects using .NET languages. The LINQ to SQL object/relational mapping (O/RM) framework provides the following basic features:


Tools to create classes (usually called entities) mapped to database tables

Compatibility with LINQ's standard query operations

The DataContext class, with features such as entity record monitoring, automatic SQL statement generation, record concurrency detection

Author: Modi Ashfaq Ahmed10 Dec 2010 Member Level: Silver   Points : 0

hi,

good article,
thanks for the info.
keep the good work going.

regards
Ashfaq Modi.

Author: karthi8982@rediffmail.com23 Dec 2010 Member Level: Bronze   Points : 0

nice definition

Author: murali04 Jan 2011 Member Level: Bronze   Points : 1

Language Integrated Query allows different features to be integrated in the basic programming language used in an application. These features can be the native query capabilities to .NET languages.

LINQ provides many query operators that can be used in a query, classes, and relational databases.
Provides language extensions to strengthen the queries.
LINQ can not just be used in queries but also with objects, XML and SQL server databases.

Author: sugandha25 Jan 2011 Member Level: Gold   Points : 1

LINQ stands for language integrated query.
It is a uniform programming model for querying and manipulation data with a consistent model from any data source.
It can also be called as an another tool for embedding SQL queries into code.
It extends powerful query capabilities to c#, vb.net languages.

Its syntax:

from id in source
{
from id in source | where condition
}
[orderby ordering , ordering, ....]
select expr | group expr by key
[into id query]

Author: SethuRaman10 Feb 2011 Member Level: Gold   Points : 1

Hi

Thanks for your valuable definition .

if You know LINQ query do post querying concept in linq as a resource i have one query problem posted let me know if you can

www.dotnetspider.com/forum/ViewForum.aspx?ForumId=277923

Author: ketan Italiya09 Oct 2013 Member Level: Gold   Points : 5

There are four main advantages of LINQ. They are,

The availability of strong typed queries: The classes are auto generated according to the relations in relational databases. The language is very much easy to understand as in SQL.

The automatic join functioning in foreign keys: In normal SQL, the user has to join the tables if it is necessary. In LINQ, it provides the ability to join each function automatically when there is a foreign key reference.

The code size: There are many occasions that the users have to write long sentences for getting a SQL query. LINQ provides relatively short codes in such advanced occasions. It reduces the complexity of the code and makes it much easy for the program to read.

Code equality: One of the most advantages in using LINQ is that its availability over any .NET platform language such as C#.net, VB.NET and F#.NET.

Author: ketan Italiya09 Oct 2013 Member Level: Gold   Points : 8

What is LINQ?

LINQ is the acronym of Language Integrated Query. LINQ is a new concept introduced in DOT NET Framework version 3.5. LINQ is supported by Visual Studio 2008 editor. With this editor, LINQ queries can be written in Visual Basic language or C# language.

Similar to Oracle and SQL Server, LINQ manipulates data sources in .NET program using queries. In C#, LINQ can be used only in C# version 3.0 and higher. The data source manipulated by LINQ can be an XML or an object like Arrays / Classes or even a relational database. Whatever it is, the selected data source can be manipulated using LINQ queries directly in the .NET program.

LINQ defines standard query operators that are available in the namespace System.Linq. With these query operators, activities such as selection, aggregation, filtering and partitioning of data from any data type can be done.

What are the Different Types of LINQ Technologies?

Microsoft offers 5 different LINQ technologies based on the LINQ providers for various data sources. The different LINQ technologies are:

LINQ to Objects – LINQ to Objects is used to manipulate on collection objects like array or list using LINQ Queries.

LINQ to SQL - The data in relational database will be recorded as rows whereas data managed by software programming language will be stored as objects. LINQ to SQL acts as the object relational mapper thereby managing data of relational database as objects. Using LINQ to SQL, entity classes can be defined and then these entity classes are associated to the corresponding tables in the relational database. Then the class named DataContext is used to access all entities available in LINQ to SQL.

LINQ to XML – If the data is available in an XML file, then that XML data can be manipulated using classes and methods available in System.XML.Linq namespace.

LINQ to Entities – In LINQ to SQL, one entity class can be linked to only one table in the relational database. If ther

Author: sambath09 Oct 2013 Member Level: Silver   Points : 6

About LINQ

It is a technique for querying data that is integrated into .NET languages such as C# and VB. As such, it is both strongly typed and IntelliSense-aware.
It has a single unitive syntax for querying multiple data sources such as relational data and XML data.
It is extensible; talented developers can write providers that allow LINQ to query any arbitrary data source.
It uses a declarative syntax that allows developers to tell the compiler or provider what to do, not how to do it.
It is hierarchical, in that it provides a rich, object-oriented view of data.
It is composable, in that the results of one query can be used by a second query, and one query can be a subclause of another query. In many cases, this can be done without forcing the execution of any one query until the developer wants that execution to take place.
It is transformative, in that the results of a LINQ query against one data source can be morphed into a second format. For instance, a query against a SQL database can produce an XML file as output.

Benefits of LINQ

Because LINQ is integrated into the C# language, it provides syntax highlighting and IntelliSense. These features make it easy to write accurate queries and to discover mistakes at design time.
Because LINQ queries are integrated into the C# language, it is possible for you to write code much faster than if you were writing oldstyle queries. In some cases, developers have seen their development time cut in half.
The integration of queries into the C# language also makes it easy for you to step through your queries with the integrated debugger.
The hierarchical feature of LINQ allows you to easily see the relationship between tables, thereby making it easy to quickly compose queries that join multiple tables.
The unitive foundation of LINQ allows you to use a single LINQ syntax when querying multiple data sources. This allows you to get up to speed on new technologies much more quickly. If you know how to use LINQ to Objects, it is not hard to learn how to use LINQ to SQL, and it is relatively easy to master LINQ to XML.
Because LINQ is extensible, you can use your knowledge of LINQ to make new types of data sources queriable.
After creating or discovering a new LINQ provider, you can leverage your knowledge of LINQ to quickly understand how to write queries against these new data sources.
Because LINQ is composable, you can easily join multiple data sources in a single query, or in a series of related queries.
The composable feature of LINQ also makes it easy to break complex problems into a series of short, comprehensible queries that are easy to debug.
The transformational features of LINQ make it easy to convert data of one type into a second type. For instance, you can easily transform SQL data into XML data using LINQ.
Because LINQ is declarative, it usually allows you to write concise code that is easy to understand and maintain.
The compiler and provider translate declarative code into the code that is actually executed. As a rule, LINQ knows more than the average developer about how to write highly optimized, efficient code. For instance, the provider might optimize or reduce nested queries.
LINQ is a transparent process, not a black box. If you are concerned about how a particular query executes, you usually have a way to examine what is taking place and to introduce optimizations into your query.

INQ - Language Integrated Query is simply a unified programming model/framework for writing SQL queries in simple language(in which you are working for eg. C#,VB,etc) without learing SQL.Here unified programming model means once you write a LINQ query for a datasource that query will be fired/executed over different-different datasource.

For Example:

Linq To Sql query:

//
// var result=from m in DataContext.YourTableName select m;
//

This is simple Linq to Sql query for selecting a record from the database having table name "YourTableName"

Author: Phagu Mahato09 Oct 2013 Member Level: Gold   Points : 1

LINQ is a set of extensions for .NET . Linq provides powerful tools, native query syntax for C# and VB. It is allowing developers to perform SQL-like queries against any .NET collection or drop down to raw SQL when needed.
Example of a LINQ query:
String [] cities = {“Indore", “Odisha ", “Bangolore",
“Dhanbad", “Dehli", “Mumbai" };
IEnumerable places = from Nation in Table
where Nation.Length > 5
orderby Nation descending
select Nation;

You can also use this code behind file which use for searching and ordering the list of strings:

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Query;

public partial class Step1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string[] cities = { "Lahore", "Amritsar", "Francisco", "Vegas",
"Boston", "Raleigh", "Chicago", "Charlestown" };

GridView1.DataSource = from Nation in cities
where Nation.Length > 4
orderby Nation
select Nation.ToUpper();

GridView1.DataBind();
}
}



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: