Introducing LINQ

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
CSharp-Online.NET:Articles
Database Articles

Introducing LINQ

© 2006 James Huddleston, et al
This article—Introducing LINQ—is from Beginning C# 2005 Databases: From Novice to Professional, by James Huddleston, Ranga Raghuram, Syed Fahad Gilani, Jacob Hammer Pedersen, Jon Reid. Copyright © 2006 James Huddleston, et al. All rights reserved. Reproduced by permission. This article has been edited especially for C# Online.NET.  Read the book review! BegCSharp2005DB.jpg

Download the source code for this article.

Introducing LINQ

ADO.NET 2.0 is a mature (but still growing) data access API that has considerably more power than we’ve covered in this introductory book. It’s reasonably straightforward to use and lets us simulate the same kinds of data structures and relationships that exist in relational databases.

However, we don’t interact with data in datasets or data tables in the same way we do with data in database tables. The difference between the relational model of data and the object-oriented model of programming is considerable, and ADO.NET does relatively little to reduce the impedance between the two models.

But the future is quite promising. Microsoft is adding a general-purpose query capability, called LINQ (Language-Integrated Query), to .NET. LINQ provides a single declarative query facility for any kind of data source, including relational data, XML, and in-memory data structures.



Note Though it’s called Language-Integrated Query, LINQ can be used to update database data. We’ll only cover simple queries here, to give you your first taste of LINQ, but LINQ is a general-purpose facility for accessing data. In many respects, it’s the future of ADO.NET. For a concise but comprehensive introduction to LINQ, see Fabio Claudio Ferracchiati’s LINQ for Visual C# 2005 (Apress, 2006).


In this chapter we’ll cover:

  • What LINQ is
  • Installing LINQ
  • Using LINQ to SQL
  • Using LINQ to DataSet


Previous_Page_.gif Next_Page_.gif

Personal tools