ASP.NET - LINQ - Asked By yashwanth kumar on 05-Sep-11 01:17 AM

WHY linq used for..?
smr replied to yashwanth kumar on 05-Sep-11 01:20 AM

refer this

  1. LINQ syntax beats SQL syntax. SQL is flawed in that queries become exponentially difficult to write as their complexity grows. LINQ scales much better in this regard. Once you get used to it, it's hard to go back.
  2. Database queries are easily composable. You can conditionally add an ORDER BY or WHERE predicate without discovering at run-time that a certain string combination generates a syntax error.
  3. More bugs are picked up at compile-time.
  4. Parameterization is automatic and type-safe.
  5. LINQ queries can directly populate an object hierarchy.
  6. LINQ to SQL provides a model for provider independence that might really work.
  7. LINQ significantly cuts plumbing code and clutter. Without sweeping stuff under the carpet, like Workflow or Datasets. This is a credit to the design team.
  8. C# hasn't suffered in the process (in fact, it's gained).
refer links for examples
Anoop S replied to yashwanth kumar on 05-Sep-11 02:45 AM
1) what is meant by LINQ?

Basically LINQ address the current database development model in the context of Object Oriented Programming Model. If some one wants to develop database application on .Net platform the very simple approach he uses ADO.Net. ADO.Net is serving as middle ware in application and provides complete object oriented wrapper around the database SQL. Developing application in C# and VB.Net so developer must have good knowledge of object oriented concept as well as SQL, so it means developer must be familiar with both technologies to develop an application. If here I can say SQL statements are become part of the C# and VB.Net code so it’s not mistaken in form of LINQ

2) what is the purpose of using LINQ in

LINQ Providers are a set of classes that takes a LINQ query and dynamically generates a method that executes an equivalent query against a specific data source.

3) Advantage and Disadvantage of using LINQ?

It allows you to query collections like arrays, enumerable classes etc in the native language of your application, like VB or C# in much the same way as you would query a database using SQL. LINQ to SQL, which is what most of the current fuss is about, is an Object/Relational Mapper (O/RM) built in to Visual Studio.  It automatically generates entity classes based on the database schema, so it helps speed up development of n-layer arhitecture applications.
Reena Jain replied to yashwanth kumar on 05-Sep-11 02:49 AM

LINQ is a set of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations. It extends C# and Visual Basic with native language syntax for queries and provides class libraries to take advantage of these capabilities.

Featured Information

Essential LINQ (Microsoft .NET Development Series)
LINQ is one of Microsoft’s most exciting, powerful new development technologies.Essential LINQ is the first LINQ book written by leading members of Microsoft’s LINQ and C# teams.

LINQ to XML was developed with Language-Integrated Query over XML in mind and takes advantage of standard query operators and adds query extensions specific to XML.

check this for more

Hope this will help you.
dipa ahuja replied to yashwanth kumar on 05-Sep-11 03:20 AM
What is LINQ? 
LINQ, or Language INtegrated Query, is a set of classes added to the .NET Framework 3.5. LINQ adds a rich, standardized query syntax to .NET programming languages that allows developers to interact with any type of data.

Three main components of LINQ or Language INtegrated Query?

1. Standard Query Operators
2. Language Extensions
3. LINQ Providers

How are Standard Query Operators useful in LINQ?

Standard Query Operators in LINQ can be used for working with collections for any of the following and more.
1. Get total count of elements in a collection.
2. Order the results of a collection.
3. Grouping.
4. Computing average.
5. Joining two collections based on matching keys.
6. Filter the results