Yesterday I attended a session on Language Integrated Query (LINQ) at MDC. Simply said it is a new technology introduced with C# 3.0 and VB 9.0 which will be shipped in the next version (Orcas) of Visual Studio. Basically, LINQ allows you to perform queries on objects, databases and XML files from within .NET languages allowing you, for example, to query your database without writing a single line of SQL code. LINQ helps you create an object mapping of your database; converting your database tables into classes which you can query from within the language. This way you can reap the advantages of Intellisense and Type Checking which were never present when you wrote SQL strings from inside the code. Below are screenshots containing the code I wrote to perform a query on the Northwind database that retrieves the customerID of customers who live in London and the results obtained from the query. It is important to mention that prior to performing this query , I used a visual designer (included with LINQ) to drag the database tables on screen, allowing LINQ to convert them into the corresponding objects.
Archive for the ‘LINQ’ Category